Microsoft KB Archive/150185

= INFO: Tab Keyword Cannot Be Used as Object Type in Visual Basic =

Article ID: 150185

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q150185



SUMMARY
The TabStrip control contains an object, Tab, which supports the various properties of a tab in the control. The word Tab cannot be used in a declaration to dimension an object. This is because Tab is a keyword in Visual Basic.



STATUS
This is by design. Since Tab is a keyword in Visual Basic, it cannot be used in a declaration without employing one of the workarounds documented below.



WORKAROUND
There are several ways to dimension a Tab object, which is part of the TabStrip control:

  Preface the object with the library in which it is contained. In the case of Tab: Dim x As ComctlLib.Tab Later in the code, x has to be set to the correct tab object. For example: Set x = New TabStrip1.Tabs(0) -or-

  Use late binding, and dimension the Tab as a generic object: Dim x As Object

Set x = New TabStrip1.Tabs(0) 

Steps to Reproduce Problem
 Create a new project in Visual Basic. Form1 is created by default. Add a TabStrip control to a form.  In the Form_Load event place the following code: Private Sub Form_Load

Dim x As Tab

End Sub  Run the project by pressing F5. Visual Basic will correctly highlight the dimension statement and report a Syntax Error.</li></ol>

Additional query words: kbVBp400 kbVBp600 kbVBp kbdsd kbDSupport kbControl

Keywords: kbinfo KB150185

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.