Monitoring Changes on a Tab Page

In my WinForms app I have a tab page with a bunch of controls on it (e.g. textboxes, checkboxes, buttons, radio buttons, etc.). Is there an event, or a few events, of the tab page that I can monitor to see if any changes to any controls on the tab page have been made?

Robert W.
http://pocketpollster.com

[310 byte] By [rwerner] at [2007-12-22]
# 1

WinForms questions are off topic for the Visual C# General forum. Your question is likely to be answered quicker in this forum, where experts in WinForms are likely to be reading questions.

I've moved this thread to WinForms General forum.

PeterRitchie at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Thanks, Peter!
rwerner at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3

rwerner wrote:
Is there an event, or a few events, of the tab page that I can monitor to see if any changes to any controls on the tab page have been made?

When tabs are changed there are no validation events that occur. When tabs change you get a series of events: Deselecting, Deselected, Selecting, then Selected. Both Deselecting and Selecting can be canceled, it is in one of these two event handlers where you'd want to check to see if your controls' data has been modified. Are you simply interested in data validation?

PeterRitchie at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
It is not the selecting of the tabs I'm interested in but the altering of controls on a tab page. I thought perhaps there was a "Parent Control" event that would be fired when anything happened to any control on a tab page. Apparently not.

Robert

rwerner at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 5
There's things you can do, like iterating through the tabpage's Controls collection and calling AddHandler for their events. However, different controls have different events and different event handler signatures. You'll need some commonality between the controls (like "Click" is usually available). What specifically are you looking for when you say "anything happened"?

Also look into SetWindowsHookEx()...

nobugz at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 6
rwerner wrote:
It is not the selecting of the tabs I'm interested in but the altering of controls on a tab page. I thought perhaps there was a "Parent Control" event that would be fired when anything happened to any control on a tab page. Apparently not.
As you're seen, there's nothing "built-in" like that. As nobugz mentioned, you could iterate all the contained controls and hooking in to each controls potentially distinct update event (almost like using Reflection on each control). Depending on you circumstances, I don't know if that would be worth the time and effort. Usually when you want to be informed of changes you do it for each control; usually in terms of validation where you have distinct logic that needs to be performed for each control.
PeterRitchie at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...