Re: Enable ot Disable a Tab in Tab Control using VB.Net
- From: "Mick Doherty" <EXCHANGE#WITH@xxxxxxxxxxxxxxxxxxxxxxxxxx[mdaudi100#ntlworld.com]>
- Date: Fri, 3 Nov 2006 14:56:00 -0000
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:
http://dotnetrix.co.uk/tabcontrols.html --> Add SelectedIndexChanging Event.
This will still require you to ownerdraw the tabcontrol in order to get the
The recommended method is to remove tabpages rather than disable them. You
will find methods to remove and re-insert tabpages on my site.
http://dotnetrix.co.uk/tabcontrols.html --> 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.
http://www.dotnetrix.co.uk/controls.html --> TabControlEx.
"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