In my project I have a settings form. Where if any changes happen I have to notify user about it if he wants to leave that page without saving his changes. At this time I am doing this by catching every control change event. I am sure there is a better way – like catching the change event from its container. Is it possible?
Share
You have the right solution, but you may want to be very generic about catching the change events. For example, you could try something like this right after the
InitializeComponent();line in the constructor:genericTextBox_TextChangedwould set a form-widehasChangedflag to true, or something really basic like that. You may need to make this into a recursive function that loops through all of the children ofcif it has child controls.