These pages collect example tutorials, programs and ActiveX controls
displaying particular programming techniques in Visual Basic.
We cannot offer any further help with these examples. Most were
developed by students who are no longer present. Our current students have
moved onto programming in C#, and thus no longer use VB. Please do not
contact us for further help, although feel free to tell us that this page
was useful to you!
These tutorials contain step by step graphical guides to several visual basic
programming concepts and tools. Note that they are not necessarily in
- A very basic demonstration and example of some controls and events
- A simple example of how to program a listbox
- MSDN: what it is, how to get at it
- MSDN sample programs online: how to get at’em
- Database example using the Data control
- Saul’s Sketchpad demo
- Saul’s Advanced Sketchpad demo
ADO Data Control
Data Environment control
ActiveX control in Visual Basic
Controls on the Computer Science machines
with the ActiveX Control Wizard
Control that lets you click on a non-rectangular image
simple example on how you can use sliders to build a query to a database
beginning guide to building ActiveX controls a few different ways along
with some ActiveX explanation
and dropping from explorer and between forms and also includes a cool control
moving code module.
for how to integrate Macromedia Flash into your VB applications. Complete with
instructions on how to pass information back and forth and also how to remotely
invoke Flash methods right in VB!
illustrates a basic VB program as well as the command button and timer
exercise for students to do.
The left figure shows when it looks like when the program is executed,
while the right shows what happens after the user has clicked the button
3 times and selected the checkbox, and moved the mouse over the form.
Try to program this yourself. It uses a command (or button), a label,
and a checkbox.
to cycle through images
stored in a local directory. Each demonstrates different controls for accessing
files, while both show a control for displaying images.
region) is used to illustrate a Timer, a status bar and a checkbox control, and simple graphical repositioning,
example of how to use listboxes (as well as how to put images into
buttons). This example lets you move items between lists.
Rod Stephens, modified by Saul Greenberg
Visual Basic. It works by declaring a function to the WIN32 API
Don’t be intimidated: its two lines of code!
one is only about 6 lines of code, and just illustrates some very basic
graphics and event handling. The second shows how one can dynamically
create controls at run time (the items on the palette), how controls can
be positioned at runtime, and how controls can be resized when the
window is resized. Its a longer program, but well worth going through to
see how these features work.
2 for step by step instructions for how these programs work.
that allows a user to create, move and erase squares. You can easily extend this to include different graphical classes
e.g., circles, lines, etc., or to any interactive graphics. The program illustrates
- how to do simple object-based interactive graphics in VB
- how to use a collection
- how to use a class
editor above, but used for completely different purposes. It illustrates
how to do dynamic queries on city attributes, where cities on a map are
filtered immediately as a person moves a slider or checks a checkbox.
While the example is simple, the possibilities of how you can enhance it
Click on the image to view it in full size.
create a very simple table lens that toggles cells between graphical and
Click on the image to view it in full size.
another picture, and how to drag it around.
how to drag items around different parts of the tree
interactively move different kinds of controls on a display.
Illustrates interactive graphics.
that raises events
control. The database
just has two fields: name and phone. This example lets you add and
remove records. To make the grid sorted, we set the data control’s
record source property to the SQL statment: Select * from friends order
by FirstName. The record is just added to the end of the file, but the
flex grid shows it sorted. See also Tutorial
3 and Tutorial 4 for other ways
to access databases.
how you can clip the shape of a control or form to a variety of regions.
tutorial and example project that shows you how to build a
minimalist VB ActiveX Control Component. It just contains a label saying
“Hello World” and has no code attached to it. However, it does
have a toolbox control icon. Includes an example program.
you how to build a TickerTape control out of a label. It also
illustrates the ActiveX Control Wizard.
type of button (actually a standard but augmented command button) that
moves away from the person who is trying to click it. Includes an
example program. The design was based upon a class project where
students had to design a button that reflected their personality.
that will follow the mouse around.
This simple but very useful example
- using the Extender object in a VB UserControl to access
outside properties and methods
- the use of calls from
the Win32 API for finding mouse cursor coordinates
- scaling those
coordinates in terms of a container object (be it a form or another
written in ActiveX. I include it to
- show you how you can do interactive graphics (well, at least some
- how you can make an active x control that you can include in a
It is limited. It does not scale its size, and I did not spend any
time doing all the things that one normally does to package up a
control. This is really just a quick hack. Feel free to improve it and
pass it on to the class.
To use: Unzip the file into a directory. Check out the test program
in a sub directory that I included. In your own project, you can include
the range slider by going into project/components and then
selecting Browse. Navigate to the OCX file that will be in the unzipped
directory and select it. You will see a new control that you can select.
the PictureClip component for creating animations.
Miller, 581 student
that shows you how to find the other controls in a form from inside an
ActiveX control. Saul Greenberg used this example to build a
Mr. Popularity button, where all the other
controls on the form gravitate towards a Mr Popularity ActiveX button.
Chris Bradley, 581 student
how you can build a transparent ActiveX Control that lets you detect
clicks on a non-rectangular image (in the figure on the right these
would be the red letters). See Tutorial
goes around the screen – very fun.
other control. This example illustrates some custom events and properties
in a user control, and shows how to do do simple control animation with a
(as zip or .bas)
A tool library to do transparency, including transparent controls.
ActiveX control that implements a range slider. Looks pretty good!
of a screen.