ActiveX Controls
In the Learning Edition of VB there were only 4 ActiveX controls, but in
the Professional Edition of VB, Microsoft has provided 20 additional
controls. Some are very excellent and some you may never use.
In this section of the tutorial I provide a few comments about each one,
trying to give some useful pointers on the use of each control.
I strongly suggest that you review my
control summary chart - available in
Excel 97 and
Excel 5.0 formats.
The chart gives the complete list of VB controls - along with their properties,
methods, and events. The spreadsheet will help you get a "big-picture"
overview of the VB controls (both Intrinsic and Pro). Equally strongly,
I suggest you read the HELP file content for each of the
properties/events/methods for these controls. If you don't know that the
property or method of an object exists, then you won't know when to apply
it in your applications!
Introduction
As with the Intrinsic controls, not all of the ActiveX controls are
equally useful.
Some you will use on many applications but you will use others only when
you have a special need for the features the controls offer.
When you start VB, none of the ActiveX controls are displayed in the
Toolbox. Only the intrinsic controls are displayed, so you must manually
insert the ActiveX controls into the Toolbox as you need them. To do so,
right-mouse click on the toolbox and go to "Components", select the controls
to put on the toolbox and press "OK".
A little tip - in the startup box for VB you can select to open a project
which contains every ActiveX control that VB installed. You might have
missed it because that option is at the end of the list of project
types that VB can open for you when you use the "File/New" menu. Here's
a picture of the Toolbox with all of the Pro controls loaded.
All of the ActiveX controls are contained within OCX files. None are built-in
to VB. In some cases, Microsoft put more than one control into an OCX file.
We'll give the file names later.
The Most Useful ActiveX Controls
Of course, everyone will have their opinion but since it's my tutorial I
get to give my own opinion for the most popular Pro controls.
These nine intrinsic controls are pretty much used on every VB application
I've written. Start your learning with these and then branch out. Further
down on this page I have a brief comment on each of the controls.
 | Coolbar |  | Progress Bar
|  | ImageList |  | SSTab
|  | Internet Transfer Control |  | Tab Strip
|  | ListView control |  | ToolBar
|  | Multimedia control
|
The Specialty ActiveX Controls
Some of the VB controls are very excellent tools, but they simply aren't
needed in many applications. This list of controls are ones that would be
on my list of the best controls except that they are just not
needed that often:
 | Communication control |  | RichTextBox
|  | Data Repeater |  | SysInfo
|  | MAPI Session |  | MAPI Messages
|  | Winsock |  | MSChart
|
The Rest of the ActiveX Controls
Of the remaining ActiveX controls, I find some useful but mostly they sit
un-used on my PC. It doesn't mean they don't perform their features well, it
just means that my own applications don't find the need for the features
very often.
 | Animation |  | MonthView
|  | DateTimePicker |  | PictureClip
|  | FlatScrollBar |  | Slider
|  | ImageCombo |  | UpDown
|  | MaskedEdit
|
Comments on Each Control
One of the things you'll notice is that I use a few controls a lot, and
don't make a heavy effort to use every available control. I've thought
about it a lot and wonder if VB programmers out there are like me, or if
everyone uses their favorites over and over? You'll have to decide for
yourself which approach makes sense. In the comments that follow I provide
some of the logic which pulls me to one of these controls, or what it is
that keeps me away!
Animation Control
Personally, I don't do games and I find animation in business programs to
be of marginal value (unless the animation is of real-time generated data).
So, this is one of the controls I seldom use. Interestingly enough, I get
a lot of questions from newbies on how to do animation and I steer them to
this control.
Communications Control
There really are some excellent reasons to become familiar with the MCI
control. Programs like Laplink are hugely successful, primarily over their
ability to work through the serial and parallel ports of a PC. I believe
that 98% of all programmers never have that need. For the remaining two
percent, however, this control can be a god-send.
CoolBar Control
The concept is great - give your program a look and feel like that of other
programs that your users are familiar with. In practice, most of our users
have been exposed to so many windows programs that an Explorer-like interface
or a Win3.1 application interface are all so easily understood that unless
your user is picking between your program and a second one, I don't believe
the look-and-feel will buy you any more users. Take advantage of it if you
want, or just use what you're familiar with.
DataRepeater Control
I tend to do things manually. Any control which automatically performs
tasks for me tends to be ignored so long as I can get the job done with
tools I'm already familiar with. This is a habit I really need to break.
As I've said before, a programmer's job is to get the job done quickly and
economically. Under those guidelines, controls such as the data repeater
should be high on my list. I'll work on it!
DateTimePicker Control
So far, I've never written a program which needed a calendar. I've done many
where a date was entered but usually the date was the current date and that
was easy to provide to the user. I can see where some programmers could put
this to good use.
FlatScrollBar
The only thing that would entice me to use this is that it can be made to
take on both horizontal and vertical orientations. That makes it pretty
versatile. Otherwise, I'm not interested.
ImageCombo Control
This solves a problem which a lot of VB programmers have asked for, putting
graphics in a list. It's more effort to program than a simple text list, but
if you want the graphics then it's the way to go.
ImageList Control
I use the Toolbar control a lot! Since the Toolbar gets its images from
this control, then that means I have to give this one a thumbs up! I need
it, I like it, and I use it all the time.
Internet Transfer Control
From what I've read, this is much improved over the version that came with
VB5. Many of my users are corporate employees from engineering areas. Their
needs rarely require an over-the-next solution so my experience on this one
is minimal. However, since it is the only internet control in VB,
then by definition you will use it if you have needs for Internet
applications.
ListView Control
The four controls - the listbox, the common dialog control, the TreeView
and this one (ListView) can pretty well handle display of data in simple
or heirarchical methods. It's a useful control, but not one that you cannot
live without.
    MAPI Controls
This is an excellent example of a control which is very specialized, so much
so that no one I know uses it. I have no doubt someone does, but I just
haven't met them yet.
Masked Edit Box Control
You'd think that this control would be one of the most popular there was
and that Microsoft would have made it an intrinsic control. But, it just
didn't turn out that way. The earlier versions of the control gave it a
very bad reputation and it doesn't seem to have recovered from it. It's
not exactly the easiest to work with and the actual operation isn't as
trouble-free as I'd like. I don't use it but I think about it a lot!
MonthView Control
Calendars in a program out to be very useful. Every PIM has one so why
haven't my own applications had them? Maybe if I'd had this control in
VB5 I'd be further along the learning curve.
MSChart Control
Yep - when I need a chart I use this one. Actually I don't like it all
that much. It has a huge number of properties and I never seem to get all
of them working together the way I want. Even so, it comes with VB and it
can be made to do the job, so I use it.
Multimedia Controll
As I mentioned, I mostly do engineering-oriented applications. The use of
.wav and .avi files would be fine, but for my needs I would want to create
the .wav/.avi files myself and VB has no means of doing so. If you can use
stock files from someone else, then this control is really a valuable tool.
It's the only control in VB that does what it does, so it must also be the
best one!
PictureClip Control
Multimedia presentations and applications really are great. But as all
artists know you can't just create a quality image in seconds. Having this
control available to house images is fine, but where do all those images
come from? Like with the Multimedia Control, this one is valuable to folks
who have access to images that already exist and which meet their own
business needs.
ProgressBar Control
This is the one where I am really delinquent. I owe it to my users to apply
this control much more often than I do. I recommend that you use it whenever
possible. The techniques of changing the cursor to an hourglass is good,
but a progress bar is much better!
RichTextBox Control
This is very much a specialty control. For 99% of my user inputs, a simple
text input is just fine. I've gotten a lot of email from users who are
using this control so I know that the lure of better looking text must be
hard to resist. However, I resist it and don't really have any reason to
recommend this one to you unless you are writing some kind of word processor
or if you really need to display formatted text.
Slider Control
Yawn. Well, maybe not. There are times when adjusting something to get
a value is needed. But I could do that with the intrinsic scrollbars
already. This control is easier to use but I wish Microsoft had spent their
money getting a totally new feature rather than a better old one.
StatusBar Control
This one is an excellent way to give your user messages about the status of
the application or about the status of a user request. I don't know exactly
why I don't use it more, but I'm certain that my bad attitude will change. I
recommend you learn how to use this one and that you apply it to virtually
every program you write.
SysInfo Control
Based on questions I get from users this one should be a big winner. There
are all kinds of reasons why a programmer needs to know about the PC on which
his .EXE is running. This control has made a good start in providing that
kind of data to an application. I'd rather have seen it built in to VB as
functions but until then you can use this control to get data that otherwise
would require the use of the Windows API.
SSTab
TabStrip Control
Toolbar Control
The Common Dialog box is easily the most useful ActiveX control, and the
Toolbar control takes second place. The control is reasonably easy to use
and I've never had any trouble with it - it works as advertised! I highly
recommend you learn to use this one.
TreeView Control
Except for the lack of a built-in ability to save its content, this control
has a lot of application potential. I've used it or one of its predecessors
in every version of VB since VB3. Learn to use it right and it can provide
a very strong user interface for the display of ordered data. If you can't
figure out how to save a tree structure, email me and I'll let you in on the
code I came up with.
UpDown Control
Pretty simple, but actually pretty useful. It should have been intrinsic too,
but it isn't. You won't have to spend much time on it to become an expert
so just learn it and then put it on the shelf until you need it. You may
not need it often but when you need what it does, you'll be pleased that
it is available.
WinSock Control
I don't use it. However, lots of my visitor do
ask questions about it and it seems to be a pretty popular control. As soon
as I bite the bullet and get more into Internet programming I suspect this
one will move up the list of favorites.
Summary
As I said, I tend to use a few controls often and a lot of controls very
seldom. If I was an expert in the controls I use infrequently, would I tend
to use them more often? It's the old problem of not knowing what you don't
know. I plan to work on stretching my control selection to give all of my
less favorite controls a better chance. In a year, we'll see if my list
of favorites has changed!
|