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 (834616)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual Basic .NET (2003)
  • 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.

MORE INFORMATION

Steps to reproduce the behavior

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.
  4. Under Templates, click Windows Application.
  5. In the Name box, type SampleWinApp, and then click OK.

    By default, the Form1.vb file is added to the project.
  6. 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.
  3. In the Properties window, click the ellipsis button (...) in the TabPage property.

    The TabPage Collection Editor dialog box appears.
  4. 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

  1. 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.
  3. Click TabPage2.
  4. Click TabPage1.

    TextBox1 appears.

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbProperties kbTabCtrl kbprb KB834616 kbAudDeveloper