Quick! How many controls come with VB? Can you list them? Well, it's not as easy as you might think. The documentation that comes with VB is a bit vague on exactly what is available to you. Even worse, I've found multiple places in the documentation which don't even say the same thing! Finally, not all that's on the CD-ROM gets installed on your PC, so you can't simply use the Components dialog box to determine every OCX control that VB has to offer! Because of that, I've created this part of the tutorial. I still have a separate section for Intrinsic (built-in) and ActiveX (separate OCX files) controls.
When I was writing the sections on the Intrinsic and ActiveX controls, I realized that the documentation for the controls was somewhat confusing. The MS Programmers Guide, the MS Component Tools Guide, and the VB HELP files weren't consistent in their description of what controls were available, nor were they clear as to which controls come with the Learning and Professional editions of VB.
Intrinsic Controls
In the next section of the tutorial, I cover the 20 controls which are built in
to VB. These controls are called intrinsic controls. Every one of the intrinsic
controls are available to every VB program you write. When you create a
"New" VB project, all 20 of the intrinsic controls will show up in
the Toolbox. This is true for all versions of VB.
ActiveX Controls
Microsoft uses this terminology to refer to any control which exists as a
separate file whose extension is OCX. To use an ActiveX control in your VB
program, the control must be registered in the Windows Registry. Usually, the
OCX control installation software handles the registration for you (such as VB
does to register the controls it provides).
If you have a control which has not been registered by other software, you can register it yourself using the free program provided by Microsoft. The program, REGEDIT, comes with all version of Windows and is usually found in the Windows folder. To use it, simply type in:
Regedit control.ocx
where the "control.ocx" is the filename of the control that you want to register.
IDE
and Controls
Here's a key point to remember. Just because you register a control does not
mean that you can use the control in one of your projects. Registration only
assures you that the control can by used by an application at run-time. Whether
or not a control can be used at design-time (within the IDE) depends on the
control.
There are many free controls which can be used freely at design-time. However, commercial controls require that you install them using a password before you can use them within your project at design time. If you simply copy an OCX to your system and register it with RegEdit, don't be surprised if you get an error message when you try to put the OCX on a form!
Intrinsic
Control List
The following list shows the 20 intrinsic controls that come with all version
of VB. I have a separate tutorial section to discuss them further:
checkbox |
frame |
OLE Container |
combobox |
horizontal scrollbar |
optionbutton |
commandbutton |
vertical scrollbar |
picturebox |
data control |
image control |
shape control |
dirlist |
label |
textbox |
drivelist |
line |
timer |
frame |
listbox |
|
Beyond the intrinsic controls, what you see and what you can install from the CDROM depend on which version of VB you've purchased. Not only that, but VB doesn't automatically install every possible OCX onto your system. Some OCXs (which can be used in the IDE) can be found on the VB CDROM. I'll show you where in just a minute!
Learning
Edition ActiveX Control List
The next list shows the OCX controls which come with the VB Learning Edition. I
show you which ones get automatically installed, and which ones you must
manually install.
Common Dialog |
CMDLG32.OCX |
automatically installed |
DataComboBox |
MSDATLST.OCX |
automatically installed |
DataList |
MSDATLST.OCX |
automatically installed |
MSFlexGrid |
MSFLXGRD.OCX |
automatically installed |
Professional
Edition ActiveX Control List
These are the OCX controls which come with the VB Professional Edition. I show
you which ones get automatically installed, and which ones you must manually
install. In a later tutorial section I also discuss which controls are the most
useful to programmers.
ADO Data Control |
MSADODC.OCX |
automatically installed |
Animation Control |
MSCOMCT2.OCX |
automatically installed |
Communications Control |
MSCOMM32.OCX |
automatically installed |
CoolBar Control |
COMCT332.OCX |
automatically installed |
DataGrid Control |
MSDATGRD.OCX |
automatically installed |
DataRepeater Control |
MSDATREP.OCX |
automatically installed |
DateTimePicker Control |
MSCOMCT2.OCX |
automatically installed |
DBGrid Control |
DBGRID32.OCX |
automatically installed |
DBCombo Control |
DBLIST32.OCX |
automatically installed |
DBList Control |
DBLIST32.OCX |
automatically installed |
FlatScrollBar |
MSCOMCT2.OCX |
automatically installed |
Grid Control |
GRID32.OCX |
automatically installed |
ImageCombo Control |
MSCOMCTL.OCX |
automatically installed |
ImageList Control |
MSCOMCTL.OCX |
automatically installed |
Internet Transfer Control |
MSINET.OCX |
automatically installed |
ListView Control |
MSCOMCTL.OCX |
automatically installed |
MAPI Controls |
MSMAPI32.OCX |
automatically installed |
Masked Edit Control |
MSMASK32.OCX |
automatically installed |
MonthView Control |
MSCOMCT2.OCX |
automatically installed |
MSChart Control |
MSCHART.OCX |
automatically installed |
Multimedia Control |
MCI32.OCX |
automatically installed |
MSHFlexGrid Control |
MSHFLXGD.OCX |
automatically installed |
PictureClip Control |
PICCLP32.OCX |
automatically installed |
ProgressBar Control |
MSCOMCTL.OCX |
automatically installed |
RemoteData Control |
MSRDC20.OCX |
automatically installed |
RichTextBox Control |
RICHTX32.OCX |
automatically installed |
Slider Control |
MSCOMCTL.OCX |
automatically installed |
StatusBar Control |
MSCOMCTL.OCX |
automatically installed |
SysInfo Control |
SYSINFO.OCX |
automatically installed |
Tabbed Dialog Control |
TABCTL32.OCX |
automatically installed |
TabStrip Control |
MCSOMCTL.OCX |
automatically installed |
Toolbar Control |
MSCOMCTL.OCX |
automatically installed |
TreeView Control |
MSCOMCTL.OCX |
automatically installed |
UpDown Control |
MSCOMCT2.OCX |
automatically installed |
WinSock Control |
MSWINSCK.OCX |
automatically installed |
Making
Your Own Choices
I've shown you which controls are available but I've yet to tell you which
controls are of any real use to you. You'll find that in applications you write,
you will use a good sprinkling of the intrinsic controls. In my experience,
about 90% of the controls on my forms have come from VB's intrinsic control
list.
Once you select the intrinsic controls you need, you'll add to your project a few of the ActiveX controls which provide a specific feature you want in your application. You are very unlikely to have an application which uses all of the available ActiveX controls. You'll often find that adding 6-10 ActiveX controls will be the most that any application requires. If you're like me, you will have 3-4 very versatile controls which you use a lot, and a very few others which you use on a regular basis.
From the available ActiveX controls, I use the Toolbar, ImageList, and Common Dialog controls extensively. The Treeview, and Tab Control round off my list of personal favorites from the ActiveX control list. I probably should make more use of the Progress bar but most of my applications don't include tasks which make the user wait long enough to warrant the insertion of a Progress Bar. Likewise, using the StatusBar would certainly help my programs be more user-friendly, but I just don't seem to generate the enthusiasm to include it on my applications.
I also depend on third party OCXs. I find that I use the Formula One spreadsheet and the Crystal Reports reporting controls very often. Other than that I have a few specialty OCXs which I use, particularly in the graphics areas.