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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -