Re: Enable ot Disable a Tab in Tab Control using VB.Net

The simple answer is that you cannot disable a tab. You can disable a
tabpage but that will only stop you from interacting with the page, it will
not stop you from selecting it.

In VS2005 you can intercept and prevent the selection by setting e.Cancel to
true in the BeforeSelect method of the tabcontrol.

In VS2002/2003 the tabcontrol does not have this method and so you need to
add it as per the example on my site: --> Add SelectedIndexChanging Event.

This will still require you to ownerdraw the tabcontrol in order to get the
disabled appearance.

The recommended method is to remove tabpages rather than disable them. You
will find methods to remove and re-insert tabpages on my site. --> Hide and Show Tabpages in a

If you really want to disable tabs, and have them appear disabled, but do
not want to write lots of code to do it then you need a third party control.

There is one on my site, which you are free to use in any way you wish. --> TabControlEx.

Mick Doherty

"Sean" <Sean@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
I have gone through the recommended article on

but still don't understand how to Enable or Disable a tab in a Tab control
usign VB.Net