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:
http://dotnetrix.co.uk/tabcontrols.html --> 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.
http://dotnetrix.co.uk/tabcontrols.html --> Hide and Show Tabpages in a
Tabcontrol.

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.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"Sean" <Sean@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E14BC108-AE56-4217-AD62-059697CD0D9C@xxxxxxxxxxxxxxxx
I have gone through the recommended article on
http://dotnetrix.co.uk/tabcontrols.html

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



.



Relevant Pages

  • RE: Tabbed SubForms Coding - Return to First Tab?
    ... Thanks so much for your detailed, excellent response. ... what you mean by selecting the TabControl as opposed to clicking on what? ... Before placing any controls on a tab make sure that this specific tab is ... You've probably got the tabcontrol selected. ...
    (microsoft.public.access.formscoding)
  • Re: Clone a tabpage in tabControl
    ... Do you intend to create all the TabPages at DesignTime, ... and add that to the TabControl instead of a standard ... Design Surface, and when done designing change it to inherit from TabPage. ... > I've created a tabControl on my form with one tab filled with 11 textboxes ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Working with tabcontrol and tabpage
    ... >I have a tabcontrol that has several attached tabpage's. ... > tabpages should be accessible at all times. ... > - change the font on the tab for the tabpages that are disabled (like gray ... > FYI - the Hide, Visible, and Enabled methods/properties do not satisfy ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Working with tabcontrol and tabpage
    ... >I have a tabcontrol that has several attached tabpage's. ... > tabpages should be accessible at all times. ... > - change the font on the tab for the tabpages that are disabled (like gray ... > FYI - the Hide, Visible, and Enabled methods/properties do not satisfy ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Working with tabcontrol and tabpage
    ... >I have a tabcontrol that has several attached tabpage's. ... > tabpages should be accessible at all times. ... > - change the font on the tab for the tabpages that are disabled (like gray ... > FYI - the Hide, Visible, and Enabled methods/properties do not satisfy ...
    (microsoft.public.dotnet.framework.windowsforms.controls)