Beginning
Overview
IDE
Projects
Forms
Controls
Intrinsic Ctrls
ActiveX Ctrls
Code
Commands
Cmd Reference
File Handling
Printing
Distribution

Intermediate
Menus
Dialogs
Mouse
Drag and Drop
Graphics
Error Handling
Databases
Database Controls
SQL

Advanced
API
Objects
Internet File Transfers
UNIX/CGI/Perl
Perl Commands
JavaScript
Web Page Forms

GBIC >> VB >> Tutorials >> Controls Overview
Controls Overview
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.


Introduction

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, REGSVR32, comes with all version of Windows and is usually found in the Windows folder. To use it, simply type in:

REGSVR32 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 REGSVR32, 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:

    checkboxframeOLE Container
    comboboxhorizontal scrollbaroptionbutton
    commandbuttonvertical scrollbarpicturebox
    data controlimage controlshape control
    dirlistboxlabeltextbox
    drivelistboxlinetimer
    filelistboxlistbox
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 DialogCMDLG32.OCXautomatically installed
    DataComboBoxMSDATLST.OCXautomatically installed
    DataListMSDATLST.OCXautomatically installed
    MSFlexGridMSFLXGRD.OCXautomatically 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 ControlMSADODC.OCXautomatically installed
    Animation ControlMSCOMCT2.OCXautomatically installed
    Communications ControlMSCOMM32.OCXautomatically installed
    CoolBar ControlCOMCT332.OCXautomatically installed
    DataGrid ControlMSDATGRD.OCXautomatically installed
    DataRepeater ControlMSDATREP.OCXautomatically installed
    DateTimePicker ControlMSCOMCT2.OCXautomatically installed
    DBGrid ControlDBGRID32.OCXautomatically installed
    DBCombo ControlDBLIST32.OCXautomatically installed
    DBList ControlDBLIST32.OCXautomatically installed
    FlatScrollBarMSCOMCT2.OCXautomatically installed
    Grid ControlGRID32.OCXautomatically installed
    ImageCombo ControlMSCOMCTL.OCXautomatically installed
    ImageList ControlMSCOMCTL.OCXautomatically installed
    Internet Transfer ControlMSINET.OCXautomatically installed
    ListView ControlMSCOMCTL.OCXautomatically installed
     MAPI ControlsMSMAPI32.OCXautomatically installed
    Masked Edit ControlMSMASK32.OCXautomatically installed
    MonthView ControlMSCOMCT2.OCXautomatically installed
    MSChart ControlMSCHART.OCXautomatically installed
    Multimedia ControlMCI32.OCXautomatically installed
    MSHFlexGrid ControlMSHFLXGD.OCXautomatically installed
    PictureClip ControlPICCLP32.OCXautomatically installed
    ProgressBar ControlMSCOMCTL.OCXautomatically installed
    RemoteData ControlMSRDC20.OCXautomatically installed
    RichTextBox ControlRICHTX32.OCXautomatically installed
    Slider ControlMSCOMCTL.OCXautomatically installed
    StatusBar ControlMSCOMCTL.OCXautomatically installed
    SysInfo ControlSYSINFO.OCXautomatically installed
    SSTab ControlTABCTL32.OCXautomatically installed
    TabStrip ControlMCSOMCTL.OCXautomatically installed
    Toolbar ControlMSCOMCTL.OCXautomatically installed
    TreeView ControlMSCOMCTL.OCXautomatically installed
    UpDown ControlMSCOMCT2.OCXautomatically installed
    WinSock ControlMSWINSCK.OCXautomatically 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.