Question

In main program I add TabPage (UserControl) to TabControl. This Control has few data I would like to have before removing it. When using TabControl.RemoveControl the sender is TabControl, and I cannot access the TabPage because I don't know which one is it (using TabControl.TabPages.Count I know that my Tab ain't remove yet so I can access it).

Is there any Event for TabControl to mark TabPage that is going to be removed? or any other idea.

Basically: I add tabpage with editing of some MySql data, and after closing i would like check is there was a Edit on that row (via bool wasEdited) and if it was edited i would like to read the id of that row. If the form for editing wasn't in seperate file i would just run method on that, and I can't use static method to access non static DataGridView to update row.

Was it helpful?

Solution

in event handler TabControl.ControlRemoved you have ControlEventArgs e. Control that's being removed is e.Control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top