How to identify the changes in TextBox?
-
Hi all: I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change? Nothend
Hi Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name, private void textBox_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; MessageBox.Show("The Current TextBox is " + txt.Name); } All the TextBox's TextChanged events will share the above event.
Cheers, Chandru.
-
Hi all: I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change? Nothend
use the TextChanged event of the textbox
-
Hi Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name, private void textBox_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; MessageBox.Show("The Current TextBox is " + txt.Name); } All the TextBox's TextChanged events will share the above event.
Cheers, Chandru.
-
Thanks. but I'm sorry, as you said ,I will write 100 enents of XXX_TextChanged ? What I care is the change,if any of the TextBoxes is changed,I will set a boolean variable false.So how to achieve that?Thanks! Nothend
Write one forAll_TextChanged and add it to all textboxes. Can be done "manually":
textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged)
or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least). Note that you have to have the proper format of the forAll_TextChanged method.Internet - the worlds biggest dictionary
-
Write one forAll_TextChanged and add it to all textboxes. Can be done "manually":
textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged)
or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least). Note that you have to have the proper format of the forAll_TextChanged method.Internet - the worlds biggest dictionary