|
i am using a combobox and a textbox control. text box behaviour depends upon selected value of combobox. These properties of combo box are assingned.
AutoComplete = true;
AutoCompleteMode = SuggestAppend;
AutoCompleteSource = CustomSource
AutoDropDown = true;
Further more .net 2.0 is under usage with visual Studios 2005.
in combobox_TextChanged() event i have assigned some value to textbox control. now i want that when user is typing over the combo box then as he types first letter the TextChanged() event is triggered and my textbox values changes accordingly. i want to control it some how so that when user ends typing only then my textbox values are changed. I tried to control it through combobox.selectionStart and combobox.selectionLength properties but thay always give 0 values. So how should achieve my goal??
Furthermore when user start typing over combobox and in case selection changes then no key event is trigered (i.e keyPress(), keyUp() or keyDown() events)but it selection doesn't changes only then keyUP() event is trigered. Moreover event of combobox_SelectionChangeCommitted()is also tested and it is not triggered when user types on combobox.
Any suggestions?
May God help u solv ur problems as well,thx in advance!!
|
|
|
|
|
how to campare two images in C#?
How to write these changes(diffrence) in another file?
|
|
|
|
|
sushilhupare wrote: how to campare two images in C#?
How to write these changes(diffrence) in another file?
How to search Google[^]?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hello All,
I'm trying to develop a solution that will import data from a text delimited file into an Access table. Because the text file is created daily with a different file name, I just can't link the file directly.
I've loading successful loading the text data into a dataset but this is where I get lost. I sure would appreciate if someone could point me the right direction.
da1.Fill(dsText);<br />
<br />
da2.Fill(dsAccess);<br />
<br />
da2.Update(dsText); //Does not work for me
supercharged
VS2005
|
|
|
|
|
I need to use some field "ID" a couple of times in loop, say for example 4 times in a loop, which one of these code would be faster ?
<br />
foreach(XmlNode XMLNODE in XML_menu.SelectSingleNode("menu").ChildNodes){<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
Console.WriteLine( XMLNODE.SelectSingleNode("@id").InnerText );<br />
}<br />
or
<br />
foreach(XmlNode XMLNODE in XML_menu.SelectSingleNode("menu").ChildNodes){<br />
string ID = XMLNODE.SelectSingleNode("@id").InnerText;<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
Console.WriteLine( ID );<br />
} <br />
What I mean is, is it faster to use "XMLNODE.SelectSingleNode" many times or should I first get its value into some string and then use that string many times?
|
|
|
|
|
Option 2 is more readable. The JIT compiler may be able to optimise option 1 to make only one call, and turn it into option 2 - but why make it hard for yourself?
|
|
|
|
|
I'm leaning toward option 2 as well... although, I'm a bit confused regarding "but why make it hard for yourself?", do you mean that I should go with the first option after all?
Thanks
|
|
|
|
|
I mean that writing and maintaining three copies of those function calls is making it hard for you, and making the code harder to read.
In general you should write readable and maintainable code. Let the compiler worry about how to optimize it.
|
|
|
|
|
I'm sorry, my english is not so very good. I'm a bit confused on what you mean regarding the code examples above. So option 2 is the better one if I undrestand correctly?
Or should I write it in a totally different way?
|
|
|
|
|
Yes. Option 2 is better.
It is better because it is easier to read.
It is also better because you are only Selecting a Single Node once.
Also if you need to change "XMLNODE.SelectSingleNode("@id").InnerText", then you only need to change it in one place.
|
|
|
|
|
The first, with:
Console.WriteLine
(
"{0}\n{0}\n{0}\n{0}"
,
XMLNODE.SelectSingleNode("@id").InnerText
) ;
|
|
|
|
|
Assuming that you actually need to do more work than just print the value 4 times, option 2 would be the better choice. It is more readable and will only allocate one string instance per loop where option 1 will allocate 4 string instances per loop.
You can also use the Attributes collection on the XmlNode object instead of a second call to SelectSingleNode . In either case, you should be aware that SelectSingleNode (or indexing the Attributes collection) can return null if the node (or attribute) isn't found, so you may want to test for that condition first.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Hi,
I have some simple XML and I want to convert the elements into strings.
My XML looks like this:
<ErrorDetail xmlns="mydomain.com/errordetail.xsd">
<RegVal AX="1" BX="2" CX="3" DX="3"</RegVal>
<RegVal AX="4" BX="3" CX="5" DX="4"</RegVal>
<RegVal AX="5" BX="4" CX="6" DX="5"</RegVal>
</ErrorDetail>
So I want to get the elements out into an array of strings like this:
strings[0] = "<RegVal AX="1" BX="2" CX="3" DX="3"</RegVal>";
strings[1] = "<RegVal AX="4" BX="3" CX="5" DX="4"</RegVal>";
strings[2] = "<RegVal AX="5" BX="4" CX="6" DX="5"</RegVal>";
But I want to do this using an XmlTextReader I think but I have not had success yet.
Can anyone help? Thanks
|
|
|
|
|
try the XmlNode.InnerXml property.
yourErrorDetailXmlNode.InnerXml should return a string containing the markup.
|
|
|
|
|
Hello all:
Can I document the (text or name) value of each item in the form . While the program executed , by pressing a button . I want txt file created and documents the values of the items >>>Any idea please<<<<<<br mode="hold" />
Thanks in advance
The way of Professional softwares start in two:
Simple codes and develop it.
Simple but effective ideas.
|
|
|
|
|
If by "item" you mean a form's control, yes. Just iterate over the form's Controls collection.
/ravi
|
|
|
|
|
Hello :
Thanks for your answer, yes I was mean a form control(radiobutton,checkboxes......etc), I want by pressing a button save thier (text&name) values . in a text file but I don't want to browse it , I want this txt file by pressing a save button created and save the status of these controls.
thanks in advance
The way of Professional softwares start in two:
Simple codes and develop it.
Simple but effective ideas.
|
|
|
|
|
As I mentioned, this is easy enough to do by iterating over the form's Controls collection and saving whatever information (i.e. properties of each Control ) you want.
/ravi
|
|
|
|
|
Hello :
Thanks for your answer, but what about the txt file, while the program executed how can I call it.....\
thanks in advance
The way of Professional softwares start in two:
Simple codes and develop it.
Simple but effective ideas.
|
|
|
|
|
It seems you may have taken on a task that's (currently) more complex than you can handle. I recommend coming up to speed with the basics of C#/WinForms programming before attempting this piece of work.
How to write to a text file[^]
/ravi
|
|
|
|
|
Thanks for you interested....
The way of Professional softwares start in two:
Simple codes and develop it.
Simple but effective ideas.
|
|
|
|
|
I've asked this before, but I didn't get an answer that fixed the problem.
Here is what I want to do:
I have a program that opens two applications (a Word document, and a hyperlink). It opens one after the other. What I'm trying to do is open the first application (the Word document) and AFTER the user closes the application, open the second one (the hyperlink).
I have tried using the boolean HasExited as well as the method WaitForExit(). Neither are working. As soon as the first application opens, the HasExited is false and WaitForExit() does nothing, even when I use the overloaded version.
Here is my code:
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();<br />
psi.RedirectStandardOutput = true;<br />
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;<br />
psi.UseShellExecute = false;<br />
psi.Arguments = @txt_Wordfile.Text;<br />
psi.FileName = @WordExe[0];<br />
<br />
System.Diagnostics.Process WordProcess = new System.Diagnostics.Process();<br />
<br />
WordProcess = System.Diagnostics.Process.Start(psi);<br />
WordProcess.EnableRaisingEvents = true;<br />
WordProcess.WaitForExit(10000);<br />
<br />
System.Diagnostics.Process.Start(txt_websiteAddress.Text);
Please Help! Thanks!
|
|
|
|
|
danielhasdibs wrote: HasExited is false
That's as it should be.
|
|
|
|
|
Ok, would you care to explain further, please? Why is HasExited false when the user has not exited the process?
|
|
|
|
|
To indicate such.
Property Value
true if the operating system process referenced by the Process component has terminated; otherwise, false.
Remarks
A value of true for HasExited indicates that the associated process has terminated
modified on Friday, February 8, 2008 3:11 PM
|
|
|
|