Sometimes there can be a requirement, which we have to prevent users from accessing certain tab pages on a tab control. But there’s no straight forward method provided on the Visual Studio IDE (2005,2008 or 2010). But we can do that easily.
Add a tab control to your windows application. (tabControl1)
Add few tabs and few controls to each tab.
Now we’ll disable one tab using the following code on the form’s load event:
** Please note : Though it does not list the ‘Enabled’ property on intellisense, it’s available.
Now if you run the application you can see, that all the controls in tab page 3 are dissabled.
But if we want to prevent from users accessing that tab, we can use this coding on tab controls selecting event (Not the page, but the control’s)
Now if you run the application and try to select that tab page, you will not be able to do so..