-
May 26th, 2011, 01:13 AM
#1
Thread Starter
Lively Member
[RESOLVED] Sintax err when trying to declare a tab object
I am trying to learn how to use the TabStrip control. I am using the VB6 help example for a very simple declaration of tabs and their titles.
I drew a TabStrip control named tabData too
I copied the code from the example, still, it tells me there is a syntax error
Code:
' The TabStrip control is named "tabData"
' Declare a variable, then use the Set
' statement with the Add method to create a new
' Tab object, while setting the object variable to
' the new Tab. Use the reference to set properties.
Dim tabX As Tab <<==syntax error here
' Tab 1: Find text.
Set tabX = tabData.Tabs.Add()
tabX.Key = "find"
tabX.Caption = "Find"
tabX.Image = "Find" ' Assuming this image exists.
What am I doing wrong??
-
May 26th, 2011, 02:34 AM
#2
Re: Sintax err when trying to declare a tab object
I don't know what other references / components you have in your Project but there's a clash with the Tab Object.
You could use
Code:
Dim tabX As MSComctlLib.Tab
to explicitly define the Tab object you want
-
May 26th, 2011, 04:48 AM
#3
Thread Starter
Lively Member
Re: Sintax err when trying to declare a tab object
Well, this tip fixed the syntax error.
Now, for my next question. (I am learning how to use the TabStrip control any good reference materials?)
The TabStrip I have already “painted” on my form, has a default tab, I assume tab index 0. Doing the above creates two new tabs, I assume index 1 and index 2, I can see three tabs on my control, the first one with no caption (0) and then the next two with the captions (1) “Find” and (2) “Draw”
How do I go about assigning a caption to tab index 0? For that matter, how do I go about changing the tab name to any tab (index x)?
-
May 26th, 2011, 04:53 AM
#4
Thread Starter
Lively Member
Re: Sintax err when trying to declare a tab object
So the code looks like this with the correction
Code:
' The TabStrip control is named "tabData"
' Declare a variable, then use the Set
' statement with the Add method to create a new
' Tab object, while setting the object variable to
' the new Tab. Use the reference to set properties.
Dim tabX As MSComctlLib.Tab
' Tab 1: Find text.
Set tabX = tabData.Tabs.Add()
tabX.Key = "find"
tabX.Caption = "Find"
Set tabX = tabData.Tabs.Add()
tabX.Key = "draw"
tabX.Caption = "Draw"
Well, this tip fixed the syntax error.
Now, for my next question. (I am learning how to use the TabStrip control any good reference materials?)
The TabStrip I have already “painted” on my form, has a default tab, I assume tab index 0. Doing the above creates two new tabs, I assume index 1 and index 2, I can see three tabs on my control, the first one with no caption (0) and then the next two with the captions (1) “Find” and (2) “Draw”
How do I go about assigning a caption to tab index 0? For that matter, how do I go about changing the tab name to any tab (index x)?
-
May 26th, 2011, 06:00 AM
#5
Re: Sintax err when trying to declare a tab object
I've never used TabStrip but I'd guess it follows fairly standard practices
Code:
tabData.Tab(0).Key = "Fred"
should set the Key for the first Tab to 'Fred'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|