Is it possible to know if any of the textbox values have changed in the application.
I have around 30 textboxes and I want to run a part of code only if, any of the textboxes value has changed out of the 30. Is there a way I can know that.
Is it possible to know if any of the textbox values have changed in
Share
Each text box will raise an event
TextChangedwhen it’s contents have changed. However, that requires you to subscribe to each and every event.The good news is that you can subscribe to the event with the same method multiple times. The handler has a parameter
senderwhich you can use to determine which of your 30 text boxes has actually raised the event.You can also use the GotFocus and LostFocus events to keep track of actual changes. You would need to store the original value on
GotFocusand then compare to the current value onLostFocus. This gets round the problem of twoTextChangedevents cancelling each other out.