|
HI,
i do not get it
i have two ConboBox That are Bound To a Table in the a DataSet
and i do not have This Problem
is it because i've Got A main BindingSource To The DataSet
and A BindingSource To Each Table In the DataSet??
or i'm just talking CRAZY ?
Have Fun
Never forget it
|
|
|
|
|
Well, maybe because working the other way round is more troublesome to implement?
Sometime I need to bind 2 controls to the same source. One for selecting the item on one part of UI and another part for displaying the selected item for reference on another part of UI. If it works the other way, I will have add the selection change handling on both control.
|
|
|
|
|
I'm trying to use sockets to create a proxy connection to a server. The whole thing worked perfectly until I tried to add a custom class to deal with the proxy (authentication etc). I have two sockets, ListeningSocket and DataSocket.
The problem is that I can't see to get listeningsocket to accept datasocket as a ProxySocket, only as a standard socket.
ProxySocket extends Socket, but I can't get it to work.
Here's the code:
In the head of the class
private ProxySocket dataSocket = null;<br />
private Socket listeningSocket = null;
The in the method to accept the connection.
listeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<br />
listeningSocket.Bind(localEnd);<br />
listeningSocket.Listen(1);<br />
Socket dataSockTemp = listeningSocket.Accept();
dataSocket = dataSockTemp as ProxySocket;<br />
listeningSocket.Close();
I'd really appreciate any help.
|
|
|
|
|
Hello Guys,
My scenario is, i have a mainform with many dockable controls. And each dockable control can have panels and some intrinsic controls (textbox, labels...). If i select text in one of the controls, toggles out and in that selection is disappearing. Basically cursor state is not getting persisted. Is there a way Windows forms take care of this or do i need to write some code on Activate/Deactivate events for persisting cursor state and setting back the cursor position?
Thanks.
|
|
|
|
|
asp.net 2.0 c#
Could you show me an example about
validating an XML string with an XSD file ?
(note: I found a lot of examples about XML files,
nothing about XML strings )
I have already managed validation with asp.net 1.1
but I'm facing problems with visual studio 2005 syntax .
Could you help me ?
Thanks in advance .
|
|
|
|
|
anto2005,
Provide some code and what the syntax errors are and maybe we can.
Regards,
Gareth.
|
|
|
|
|
this is my code :
public bool ValidateXML(string xml, string xsdPath, ref string desc)
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add(XmlSchema.Read(XmlReader.Create(xsdPath), Schema_ValidationEventHandler));
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += new ValidationEventHandler(settings_ValidationEventHandler);
byte[] data = Encoding.ASCII.GetBytes(xml_string);
MemoryStream memStream = new MemoryStream(data);
XmlTextReader textReader = new XmlTextReader(memStream);
XmlReader rdr = XmlReader.Create(textReader, settings);
try
{
while (rdr.Read()) ;
}
catch (Exception e)
{
desc = e.Message;
rdr.Close();
}
return true;
}
|
|
|
|
|
previous code doesn't work .
This means that validation doesn't fire .
(function always returns "true" )
Is there a syntax error ?
|
|
|
|
|
sorry , this is my code :
public bool ValidateXML(string xml, string xsdPath, ref string desc)
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add(XmlSchema.Read(XmlReader.Create(xsdPath), Schema_ValidationEventHandler));
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += new ValidationEventHandler(settings_ValidationEventHandler);
byte[] data = Encoding.ASCII.GetBytes(xml_string);
MemoryStream memStream = new MemoryStream(data);
XmlTextReader textReader = new XmlTextReader(memStream);
XmlReader rdr = XmlReader.Create(textReader, settings);
try
{
while (rdr.Read()) ;
}
catch (Exception e)
{
desc = e.Message;
rdr.Close();
return false ;
}
return true;
}
|
|
|
|
|
I have been able to launch a batch file from a C# program in a number of ways.
Duncan Mackenzie's blog on msdn shows a number of ways how it can be done and I have tried them. (http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx).
But I have a unique problem. The batch file launches a program that seems to require that a command window (cmd) be open when it runs. Because of this, the batch file works if I launch it from a command line, but when I launch it in a C# program, an exception is thrown.
So my question is this. How can I open a cmd window from C# and feed it the command to run the batch routine?
|
|
|
|
|
Use Process class to start new process. Specify cmd.exe as a program to run and pass the location of bat file as an argument. This should help.
BTW, what is the exception that you are getting?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
When the compiler gives this warning, does the code actually compile? Is any MSIL generated for the code that is unreachable?
|
|
|
|
|
Use ILDasm on your assembly to find out.
Very nifty tool.
Scott
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
carbon_golem wrote: Use ILDasm on your assembly to find out.
Very nifty tool.
I second that.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Jasmine2501,
Try it out and see what happens, but why would you want something like this to be compiled? If you have code that is unreachable you might as well just hit the delete key on it.
Regards,
Gareth.
|
|
|
|
|
Yes exactly, but I'm interested in proving that it results in no-codez - because I'm hitting the delete key on someone else's stuff and they swear the compiler warning is just something to be ignored.
|
|
|
|
|
I believe it can be ignored as much as it warns you for unassigned variables etc, but if you want to modify someone else's code, how about commenting out segments you wish to change, or better yet just clone the project and play with it to your heart's content.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Well I'm working in a company environment... anything I do has to integrate with everything else. This is a super-large project. It takes Visual Studio literally 5 minutes to compile the site and all the DLLs and everything. I'm optimizing things, and I do have free reign on the code at the moment, but I do have to justify what I do sometimes.
I realize that the warnings don't prevent the thing from working, but they are not be ignored. One of my mentors always said "warnings are like a sign saying the bridge is out - it won't keep you from going down the road, but there's gonna be trouble eventually"
|
|
|
|
|
Hi,
I use #if false and #endif for hiding code.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Yes and no.
A switch statement with a return immediately before a break. The break is unreachable so is not compiled into IL.
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
No, there isn't - which I'm a bit surprised about. Makes no sense to include unreachable code I guess. Confirmed via Reflector/ildasm.
Regards,
Rob Philpott.
|
|
|
|
|
Just be sure it's not the result of conditional compilation. Though even then it should be written so as not to produce a warning.
|
|
|
|
|
Yes, our site originally had over 100 compiler warnings when you build. I consider that a Bad Thing. I've got it down to 23 at the moment, but I want to get it down to zero. Warnings are the computer telling you that something stupid is going on, not a broken something stupid, but still something stupid, and in most cases you just delete the thing, or code it a different way and it's functionally equivalent, but doesn't cause the warning. The break after a return statement is a good example... not having the break eliminates the warning, the break isn't necessary, and it's probably just there because somebody was told to put breaks in their switch/case blocks and was never told what it actually does.
|
|
|
|
|
Good Afternoon
I have been using vb.net am i recently moved to C# and thanks to codeProject am comming alright. now in vb.net we had Events ready generated for us on controls like button, when you double click on the button, on the right hand side you could select the events like "keypress", but vs on C# does nto have that.How is it done in C#, do i have to code the events myself?
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|