I have two textboxes with textchanged events开发者_开发技巧. When I enter characters in first textbox and press enter, the textbox1_textchanged event is fired. Then I enter some characters in the second textbox and press enter, the textbox2_textchanged event fires as well. However, when I move my cursor in first text box without changing any characters and pressed enter, the events won't fire for both textboxes.
I want the respective textbox events to fire without changing any characters in textboxes. If I press enter with some characters in textbox1/textbox2 its txt_changed events have to fire.
I have tried, but if I enter characters in textbox2 first the textbox1_textchanged get fired. Any help?
Since you haven't tagged with a webforms/mvc tag I'm going to go ahead and assume this is a WinForms question, in which case look at:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox%28v=VS.100%29.aspx
See the "Events" section for a list of all the events a textbox supports.
My guess is you'll want to focus on Enter and Leave events, as well as your text_changed events that you already have.
I'm also assuming (I'm assuming a lot since you've specified little) that you have the latest version of .NET at hand and not something from the dark ages, so I've pointed you at the .NET 4.0 reference.
精彩评论