gvector1
asked on
Change Monitor
Is there any simple ways to monitor a forms control and all of its subcontrols for changes made to the containing text.
Ex. A form has a tabcontrol containing multiple textboxes. If any one of the textboxes values change, I would like to set a boolean variable accordingly. Is there any approaches that are suggested to this???????
Thanks,
Kendal
Ex. A form has a tabcontrol containing multiple textboxes. If any one of the textboxes values change, I would like to set a boolean variable accordingly. Is there any approaches that are suggested to this???????
Thanks,
Kendal
ASKER
Doesn't the ontextchanged event only get triggered if the text property of the form is changed?????? My specific incident has a tabcontrol. If any of the textboxes, belonging to the tabcontrol, text properties changes I would like to set the boolean variable. Because of your suggestion, I though of having a single event and pointing each textboxes textchanged event to that one event. Do you have any other suggestions??????
Thanks,
Kendal
Thanks,
Kendal
That is where I was leading to... Basically when you create the tabcontrol you could register for the event at that time... so the same event handler would be listening to all the possible events for the textchange.
ASKER
Wouldn't I still have to point each textbox's textchanged event to that one event?????????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, so for instance. On the form designer, for each textbox, I set the OnTextChange event to actually trigger the MyEventHandler method. Is that correct?????
Yes, I believe that that should work...
ASKER
Thanks for the assistance.
The points are yours.
Thanks,
Kendal
The points are yours.
Thanks,
Kendal
MyForm has YourForm has YourText....
public class MyForm : From {
private bool hasTextChanged = false;
public MyForm() {
Form YourForm = new YourForm();
YourForm.OnTextChanged += new EventHandler( YourForm_TextChanged );
}
private void YourForm_TextChanged( object sender, EventArgs args ) {
hasTextChanged = true;
}
}
HTH