Search code examples
c#.netwinformstabpage

.NET WindowsForm - TabPage GotFocus Event


This page indicates that TabPage has a GotFocus event, but in Visual Studio 2008 I don't see that option on the TabPage (it says it is inherited from the control, i.e. the TabControl).

What event would I use to write some code that runs each time a user clicks on a different tab? Would I use the GotFocus of the TabControl - but in that case, when user switches to different tabs doe sthe GotFocus fire again (and pass me the tabname as a variable?)


Solution

  • Tabcontrol in Windows.Forms has SelectedIndex Changed-Event and SelectedTab Property.

    So registering TabControl.SelectedIndexChanged ask for the TabControl.SelectedTab is all you need.