C# catch control's change event from its container -


in project have settings form. if changes happen have notify user if wants leave page without saving changes. @ time doing catching every control change event. sure there better way - catching change event container. possible?

you have right solution, may want generic catching change events. example, try right after initializecomponent(); line in constructor:

foreach(control c in controls) {     c.textchanged += new eventhandler(generictextbox_textchanged); } 

generictextbox_textchanged set form-wide haschanged flag true, or basic that. may need make recursive function loops through of children of c if has child controls.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -