Education is the most powerful weapon
which you can use to change the world.
-Nelson Mandela
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
Courses - Microsoft Visual Basic 106
Description: Using Microsoft Visual Basic
Running Time: 67 minutes
Pre-Requisites: Visual Basic 105 strongly recommended
Versions: We use Microsoft Visual Basic 6.0, but lessons are valid for most earlier versions of VB, including 4 and 5. If you have VB.NET or VB 2005, the Visual Basic code we use is similar, but the programming interface has changed. These VB courses do NOT cover VBA (Visual Basic for Applications) which is what you need for Microsoft Office programming. For VBA, see the individual Office applications (Word, Excel, Access, etc.) Click here for more information on VB.NET courses.

Order Now: $15.99



 Click here for the Teacher's Outline
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 released.

This course follows VB105. We'll begin by learning how to use Frames to group objects together.

I'll show you a trick to overlay and hide/show groups and create a pseudo-Tabbed interface with them.

In our example, you can click on the different buttons
to show the different groups of controls - hidden in frames

Next we'll learn about the Format menu, and how to use it to auto-align our controls, resize objects, send to back, bring to front, and more. I'll show you the Form Editor Toolbar, and how to lock your conrols. We'll also learn more about Nested For Loops. I'll show you a cool trick to animate a label and make it run across your form.


Next, we'll learn all kinds of different Events: GotFocus, LostFocus, KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, MouseUp, Form Load, Unload, Activate Deactivate, Change, Click, DblClick, and we'll learn about ASCII key codes.

We'll make a status box so you can see exactly when and how
all of these different events fire. One click on a TextBox can generate
several different events that we can use.

Next we'll spend a lot more time with the MsgBox command. We'll learn how to pop up different types of boxes (critical, information, question, etc.) and how to get different responses (yes/no, yes/no/cancel, abort/retry/ignore, etc.)

And of course, we'll learn how to respond to each of these selections in code.


Next we'll learn about about a powerful component that comes with Visual Basic, but isn't installed by default. It's called the Common Dialog Control. First, I'll show you how to install it.

We'll make a button to browse for a filename...

Which opens up the Common Dialog File Window...

And I'll show you how to display the result.

You can also use the Common Dialog Control to open up a color palette with the Color Chooser Window...

And then we'll use that user-selected color to change the background color on our form at runtime!


Next we'll learn about the Drive, Directory, and File Controls which allow the user to have more direct control over the files, folders, and drives on his machine.


In the last lesson of this course, we'll have some fun with the Line and Shape controls. I'll show you how to animate them, move them, and resize them with code. We'll also learn about some advanced shape properties.

You obviously can't tell from this picture, but the red line and
circle dance around on the screen thanks to some cool animation tricks



 Click here for the Teacher's Outline

Try a FREE Demo Lesson


Student Interaction: Visual Basic 106

Richard on 1/1/2008:  VB106 covers frames, the format menu, event timing, gotfocus, shapes, advanced msgbox techniques, common dialog control, drive, dir, and file list boxes, and more.
Richard on 2/1/2008: Don't panic about the shapes you see on the form. I actually recorded the NEXT lesson first, but decided to move it after this lesson in the course. We'll talk about these shapes in the next lesson!
Robert M. Lilly on 3/5/2008: Hi Richard:
At 77, I have a problem remembering all the various places that you set aside for your examples, instructions, etc. Would it be possible for you to place a link on the Home Page that would take one to an informational page that would list all of your courses? Then one could select the course of interest, which would take them to a page that would list all of the various options for that course. This would be a tremendous option, one would not have to stop what they were doing, and they could go directly to the information without looking up or remembering a web site.
I truly appreciate the effort that you put in to developing your courses. I spend hours daily trying to learn from them, but at my age it is difficult to remember from day today what I learned yesterday.
Another thing I would like you to tell is that I have a real hearing problem. I have two hearing aids which I don’t wear because they pick up all the room noise. But because you speak so clearly, pronounce every word so distinctly, every syllable truly stands out. And it also helps that you speak at a frequency that is conducive to my hearing.
I know and expect, at some point in time as your business expands you will turn over the productions of your courses to someone else. I can only hope that time doesn’t come too soon.

Richard Rost on 3/13/2008: Robert, there are complete course INDEXES for a lot of of my courses on the web site already. If you go up to the MENUBAR at the top of any web page and hover your mouse over the COURSES link, you'll see it expand. Select the group (such as Microsoft) and then the specific course (such as VB). You'll see info for each course, and way over to the right side you'll see an INDEX link. Click on that. You'll find a complete topic-by-topic index of each item covered in all of the VB courses (similar indexes exist for Access and Excel, I'm working on the others). On this page you can press CTRL-F in your browser to search the index. There is also, of course, a site-wide search function on the menu as well. It's powered by Google, so if you want to remember where, for example, I talked about Update Queries, just type that into the search box.
leroy diaz on 8/4/2008: is there a way to make the listbox to advance to the next item down the list, i mean if your useing a listbox to store you music in and you don't want to have to click on it to play can you make the listbox advance to the next song
Richard Rost on 9/8/2008: Leroy, that would depend on how you've coded the playing of your song. If you're using, for example, Windows Media Player, you'd have to figure out how to program for the event that handles when the song is finished. It's been a LONG time since I've done any coding with WMP (I use it in my Video Player, but I wrote it about 6 years ago). I believe there's some kind of an OnFinished event that fires... you can then use that to advance your song. Is it possible? Yes. Can I explain it here in a few lines - nope. If you REALLY want to see this, let me know and I'll try to make a lesson out of it.
Nicos Solomonides on 12/5/2010: You haven't told us anything about the theory of VB6, so far!

Reply from Richard Rost:

I don't spend a lot of time on theory in this class. I prefer to focus on the specifics of how to actually DO things. What kind of theory would you like to learn? Perhaps a separate course would be warranted.

Rafael Seneriz on 6/13/2014: When I openProject-> Components->Controls, I don't have any controls in the screen. What do I have to do in order for the list of contols to appears? time index 01:26
Alex Hedley on 6/23/2014: Do you mean the controls box on the left hand side which has the button, label etc controls that you drag onto a Form?

View (Tab)

You can add more using

Project (Tab)
Components (Ctrl+T)

This allows you to add other controls, like the Common Dialog one.

MUBEEZI MICAH on 10/4/2014: Time index 5:15:
one nifty trick i use (in Access) is to first position say Text4 in the place of my choice. Then i copy its Top Property Value. I then paste it into the Top Property of in this case Label1. if i want to align the controls to the left, i use the Left Property

Reply from Alexander Hedley:

That's a great tip, Thanks Micah


You may want to read these articles from the 599CD News:


Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP