I have a WinForm App(.Net 3.5) that we use in house for data entry…ish, like things. Member Plans, Demographics, etc. The App has a Shell Form with all the navigation and then embeds a UserControl based on there navigation choices.
I need to be able to tell if they have made any changes in any of the controls so that I may pop up a Save reminder if they try and navigate away. What is the best way to go about that? Any and all suggestions are welcome.
I assume it is ridiculous to have hook into an event for each control on each User Control to check if any data was entered, correct?
If you’re using Data Binding, you can implement INotifyPropertyChanged (either by hand or by generating a runtime proxy) in your classes, subscribe to PropertyChanged event and do all the tracking there.
If not, you can recursively iterate over controls on form/usercontrol, subscribe to appropriate events for each control (for example
TextChangedfor aTextBox,SelectedItemChangedfor aComboBoxcontrol, etc.) and forward calls to your tracking routines.