Microsoft KB Archive/834616

= Properties or methods of the TabPage control function incorrectly if you set the Visible property or the Enabled property to false or if you call the Hide method or the Show method of a TabPage control programmatically =

Article ID: 834616

Article Last Modified on 11/27/2007

-

APPLIES TO


 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic 2005

-





SYMPTOMS
When you set the Visible property or the Enabled property to false or you call the Hide method or the Show method of a TabPage control programmatically, these properties or methods of the TabPage control function incorrectly.



STATUS
This behavior is by design.



Add a TabControl control to a Microsoft Windows form

 * 1) Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
 * 2) On the File menu, point to New, and then click Project.
 * 3) Under Project Types, click Visual Basic Projects.

Note In Visual Studio 2005, click Visual Basic.
 * 1) Under Templates, click Windows Application.
 * 2) In the Name box, type SampleWinApp, and then click OK.

By default, the Form1.vb file is added to the project.
 * 1) Add a TabControl control to the Design view of the Form1 form.

Add TabPage1 and TabPage2 to the TabControl control

 * 1) On Form1, Click the TabControl control.
 * 2) On the View menu, click Properties Window.

The Properties window appears.
 * 1) In the Properties window, click the ellipsis button (...) in the TabPage property.

The TabPage Collection Editor dialog box appears.
 * 1) Click Add two times.

TabPage1 and TabPage2 are added to the TabControl control.

Add a TextBox control and a Button control

 * 1) Add a TextBox control to TabPage1 in the TabControl of the Form1 form.
 * 2) Add a Button control to the Form1 form.

Hide TabPage1 programmatically
  In the OnClick event of the Button control, add the following code: TabPage1.Hide Note You may use the following code to hide TabPage1: TabPage1.Visible=False You may use the following code to disable TabPage1: TabPage1.Enabled=False 

Verify that the application works

 * 1) On the Debug menu, click Start.
 * 2) On the Form1 window, click Button1.

TextBox1 is hidden. TabPage1 is not hidden.
 * 1) Click TabPage2.
 * 2) Click TabPage1.

TextBox1 appears.

