Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including right ocx

Status
Not open for further replies.

OttSens

Programmer
Dec 13, 2001
80
US
Hi All

I'm getting a problem with using the tab strip control.
What I want to do is create and add tabs at runtime
(as in the msdn example). However my project complains
about the type "Tab"
Dim tabX As Tab
This gives me a "Expected: New or type name" message.

I assume this is because the proper reference is not
included in the project.
I've tried adding
MSCOMCTL.OCX
MSCOMCTL2.OCX
COMCTL332.OCX
which are the ocx files I see associated with the components
on my toolbar. Adding any of these gives me a "conflicts
with existing module" message.

I'm using the sstab elsewhere in the project. Perhaps this
is a problem?
Any Ideas what's going on here?
 
The Tab Strip control is in MSCOMCTL.OCX. If you've checked this component, you'll see the Tab Strip in the Toolbox.

Then

Dim X as TabStrip
 
OttSens,
You may want to try running the package and depolyment wizard . Its located in the tools folder of the visual studio/basic folder. It will locate all nessacary files and ocx's. Brad,
Hey! email me any time! Bradsvb@yahoo.com
 
Thats fine but the problem arises when I try to
create tabs to populate the tab strip.

1. I have put a tab strip on the form at design time.
2. I want to add tabs dynamically at runtime.
3. When I add the code "Dim tabX As Tab" the I get a
compiler error "Expected: New or type name".
4. Adding MSCOMCTL.OCX under project -> references produces
"Name conflicts with existing module, project or object
library" (which tells me that it's already included.)

The question is what do I need to do to get vb to find the
type "Tab", which it is not now? Hence the compiler error.
 
I got around it. I just use
Set tabX = TabStrip1.Tabs.Add()
tabX.Caption = "Tab2"
No need to dim a tab variable.
 
Is it safe to assume that you are not using Option Explicit?
 
The reason you cannot Dim X as Tab is because Tab is a reserved word to VB.
 
The VB Programmers Guide is incorrect.

Unfortunately, so is the knowledgebase article that balves mentions - mainly becuase it is out of date.

The correct syntax for dimensionin a Tab object for a Tabstrip is currently:
[tt]
Dim X As msComctlLib.Tab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top