|
there exist is a big conversation about this . has to do with mvc architecture .if you want standard .net framework look at microsoft databinding . every control has a data binding list .you can unify the way bi directional notification is made use code like this
textBox.DataBindings.Add("Text",object,object.property); wich means syncronize the textbox .text with the object.property
it is a dificult subject but worth it . or use the code the friend just gave you.
http://www.codeproject.com/KB/database/databindingconcepts.aspx[^]
http://msdn2.microsoft.com/en-us/library/ms752347.aspx[^]
f(yf) = yf
modified on Thursday, March 27, 2008 4:33 PM
|
|
|
|
|
I am having Visual C# 2005..
But the breakpoints dont seem to work when I create a console application..
Why?
It works in a windows form application though..
|
|
|
|
|
Debug breakpoints in console apps work just fine. You are running in debug mode, yes?
|
|
|
|
|
It could also be that terminal services service is inactivated.
For some reason, the TS service is used for debugging winforms and console apps.(dont know if it affects asp.net debugging to)
And im not talking about remote debugging, just normal local debugging.
I had this problem once and after some serious headscratching i found out about this on some msdn page.
|
|
|
|
|
Hi,
I have a BackgroundWorker that i use to select from a database. At the moment i have a ProgressBar that just loops so the user isn't just sat there wondering whats going off, but i want to make it so it actually links into how many rows i have selected so far.
eg: the ProgressBar is actually displaying the current progress of the select
Does anyone know how i would go about this?
Regards,
Gareth.
|
|
|
|
|
Hi Gareth,
if your database access is a single query, you will not be able to get any
meaningful progress information: the query is either ongoing or done, that's it.
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.
|
|
|
|
|
Hi Luc,
I was hoping you weren't going to say that!, Ahh well.
Regards,
Gareth.
|
|
|
|
|
[rant]
Why is that when I assign the same data source, like a List<string> to two ComboBoxes (for example), the two ComboBoxes synchronize their selection? Why should a List<string> data source (or any data source for that matter) be shared in anything other than a read-only, here's the list usage? Ok, yeah, I get that the control needs to update if the data source changes, but even then, why should that cause the selection of an item in ComboBox 1 to cause ComboBox 2 to make the same selection??? This is ridiculous! It is not that uncommon to offer selections using the same data source, but now I have to clone the damn thing to decouple this "feature".
[/rant]
|
|
|
|
|
Hi Marc,
the plus side is you can have many controls on one or more containers, all
behaving like clones of each other.
the down side is as you said.
the reason probably is each data source supports multiple viewers but only one view,
i.e. all viewers get exactly the same data, selection, etc.
BTW: great subject line!
PS: I reckon Chris would answer "by design".
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.
|
|
|
|
|
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.
|
|
|
|