yanci1179
asked on
one event handlers for multiple actions
I have 10 text boxes and what I would like to do is when one of them changes
to enable the save button.
Instead of having 10 diff event handlers for each text box is there a way that I can have one event handler that handles text change on all the textboxes?
I have:
this.TxFName.TextChanged +=new EventHandler(TxFName_TextC hanged);
this.TxLName.TextChanged +=new EventHandler(TxLName_TextC hanged);
private void TxFName_TextChanged(object sender, EventArgs e)
{
}
private void TxLName_TextChanged(object sender, EventArgs e)
{
}
I have this ten times. There has to be an easier way. Any ideas?
thanks.
to enable the save button.
Instead of having 10 diff event handlers for each text box is there a way that I can have one event handler that handles text change on all the textboxes?
I have:
this.TxFName.TextChanged +=new EventHandler(TxFName_TextC
this.TxLName.TextChanged +=new EventHandler(TxLName_TextC
private void TxFName_TextChanged(object
{
}
private void TxLName_TextChanged(object
{
}
I have this ten times. There has to be an easier way. Any ideas?
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks Idle_Mind.
Also, Do you know what is the best event to use. I tried TextChanged and I guess since onload the focus is set to the textbox it assumes textchanged so it automatically enables the button. I used Validated and that works okay when the user tabs to another control.
But it enables the button even if no text is changed, all it takes is to move to another control.
Thanks for your help.
Also, Do you know what is the best event to use. I tried TextChanged and I guess since onload the focus is set to the textbox it assumes textchanged so it automatically enables the button. I used Validated and that works okay when the user tabs to another control.
But it enables the button even if no text is changed, all it takes is to move to another control.
Thanks for your help.
I gave the same solution as idle_mind and a few seconds faster. a split should have been the proper way to go on this.
nothing personal, but it happens too many times (this is the 3rd time in the last few weeks (cumulated with another ta); more or less the same situation)
what is done is done, just pay more attention next time.
peace.
nothing personal, but it happens too many times (this is the 3rd time in the last few weeks (cumulated with another ta); more or less the same situation)
what is done is done, just pay more attention next time.
peace.
ASKER
sorry, i'll check next time.
can you answer this one:
https://www.experts-exchange.com/questions/21886146/event-handler-for-modified-text.html
can you answer this one:
https://www.experts-exchange.com/questions/21886146/event-handler-for-modified-text.html
I just got home. I'll take a look at it in half an hour or so if nobody gets to it.
this.TxFName.TextChanged +=new EventHandler(TxFName_TextC
this.TxLName.TextChanged +=new EventHandler(TxFName_TextC
private void TxFName_TextChanged(object
{
}