|Notice: this course covers
the older Visual Basic 6.0 programming application. Microsoft no
longer sells VB6. If you want to learn VB6, you'll have to find a used
copy somewhere like eBay or Craigslist. We will be updating this course
for use with Visual Basic 2013 soon. If you've purchased this
course within the last year, you'll get a free upgrade when it's
This course follows VB103.
We'll begin by looking at how to create programs with multiple forms.
We will learn about the Project Explorer, the Load Form method,
the Form.Show method, the vbModal property, and learn about
Modal vs. Modeless forms.
The Visual Basic Project Explorer
how to read a value from another form. You'll also learn about
the Date function, how to calculate days (and years) between two
dates, the CDate function, the End statement, how to Hide
and Unload a form (and what the difference is), and how to change the
In this example, we'll make two
forms - a Customer form and
an Age Calculator form. The Age Calculator will read the
Date of Birth from the Customer form and calculate Age in years.
Next you'll learn all about Label Properties
(Alignment, Appearance, BorderStyle, Font, FontColor, BackColor,
ToolTipText) and - more importantly - how to manipulate all of
these with your VB code (not just in design). We'll also learn
about the Timer Control and assigning string variables to label
In this example, the Age Calculator
automatically calculates the
Customer's age and updates it every second in realtime.
In the next lesson we'll learn about Multi-Line
Text Boxes, Scroll Bars, several new properties, events, and
functions: MaxLength, Enabled, Validate, IsDate, and IsNumeric.
I'll show you how to select text with VB code.
In this example, we disable
the Age Calculator button until
the user enters a valid Date in the DOB field. Also, I've selected
the first several characters of the Multi-Line Textbox with code.
In lesson five we learn a lot more about
Command Buttons, including how to create a default button and a
cancel button. We'll learn a trick to make ALT-key combinations
for our buttons (so a user could press ALT-A, for example, to push a
button). We'll also see how to create graphical buttons and
change their color.
Next we learn aboutt creating Check Boxes. We'll learn about the
BackStyle and BackColor properties, how to read the CheckBox value in
our code (vbChecked, vbUnchecked).
Then we'll learn how to change CheckBoxes into
Toggle Buttons. We can change their colors, change their captions,
put images on them, and do all kinds of neat stuff with them... all at
runtime in our VB code.
When the user clicks on this Toggle
Button, our VB code
changes the caption and the color at runtime.
Yes, I should have chosen an image that
background color of the button, but this is just an example.