An investment in knowledge
pays the best interest.
-Benjamin Franklin
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
Courses - Microsoft Visual Basic 102
Description: Using Microsoft Visual Basic
Running Time: 67 minutes
Pre-Requisites: Visual Basic 101 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: $9.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 picks up where VB101 left off. We will expand upon many of the topics and techniques we learned about in that class. First, we will begin by learning more about the IF / THEN statement, to include ELSEIF and ELSE clauses.


Next, we will learn how to prompt the user to enter in data, by using the InputBox function.


We will also learn how to let the user select an option from a list of available data, by means of the Combo Box control.


We will build a couple of simple math quiz programs to sharpen our math skills. The first will be a simple program to have the computer give us two numbers, and we have to add them up and give the right answer. The second program will help us to sharpen our multiplication skills.


These programs will teach us how to use and declare variables, how to generate random numbers, and how to generate sequential numbers using a FOR / NEXT loop. We will also learn how to properly document our code with comments.


In our next lesson, we'll have some fun by creating an Image Viewer using the Image control. A user will be able to specify a filename, click on a Load button, and watch their image loaded into your VB program.


After that, we will build a simple loan calculator, where you can enter in the amount of a loan (such as a home mortgage), the number of months, and the interest rate, and your program will calculate the monthly payment amount. This lesson will teach us how to use the PMT function. We'll also learn about the line continuation character.


This course is a good course to follow VB101 with. We cover many fundamental aspects of the VB language, and we will continue to build on these skills in VB103.


 Click here for the Teacher's Outline

Try a FREE Demo Lesson


Student Interaction: Visual Basic 102

Richard on 1/1/2007:  If/Then, Inputbox, variables, random numbers, For/Next, Looping, image controls, PMT, build a loan calculator
 Robert on 12/16/2008: Richard - I liked Access so much I wanted to start this course too. Here is my question: In VB101-5 at 9:00 you are showing us to use the val function to get the math to work. Without the val as in Answer= val(firstnumber) + val(secondnumber)it would not compute. But then in lesson VB102-1 and 2 you do not need to use the val function to calculate the commissions, why? what did I miss. Thanks

Richard Rost on 1/19/2009: Robert, if you are dealing with a TEXT BOX on a form, then VB sees that data as a TEXT STRING. You need to use VAL() to convert it to a number.

If you are using MEMORY VARIABLES then you don't need VAL() because you've already specified when you DIM'd the variable what type it is (integer, etc.)

Karl Peters on 4/17/2009: Oh, by the way, when it came to programming, i ALWAYS for some reason, had a major problem with arrays, indexing, and looping. As to for some reason i really want to know more about programming databases. For the first time, i am finally getting somewhere in understanding about the indexing, looping, and arrays and how they all fit together. After all the books i've read, it's finally sinking in, love your video tutorials....great product
Karl Peters

Karl Peters on 4/24/2009: What helps me and what i like to do after watching your tutorials several times, is to take what i have learned so far and try to make your projects just a little bit more elaborate just for the practice and discovering new things. My question is, in the times table quiz in video 4 of lesson two, we created a FOR NEXT Loop. What i attempted to do was create a times table where as one can click on a command button 1 thru 10. And each command button would come up with a one times table all the way to a 10 times table (Yes i had 10 command buttons, each one representing a times table. Ex... Command button name OneTimesTable with the caption of "1" and another command button named TwoTimesTable with the caption of "2" etc....
all the buttons worked great, got the user to put an answer in an Input Box and told the user as to whether they they were right or wrong. Everything worked just like it should have and wanted to. My question to you is, what i tried to do (just to see if could do it, helps me learn proper structure of the language) was to add another input box and have it pop up after the user puts the answer in and a MsgBox pops up telling the user "Correct" or "Incorrect" Then i added another input asking a person to "Continue" Y or N. What i am asking (after being long winded with the explanation LOL) is, how can i get another InputBox to pop up after each iteration in the loop is asked, come up with an input box ask the user if he or she wants to quit while in the middle of a loop and end the sub. So far i have not been successful. I know your busy, but i am very curious
Karl Peters

Richard Rost on 4/24/2009: Karl, I think what you want to know is covered in VB106. I show you how to use the MsgBox function to return a value (yes, no, abort, retry, cancel, etc.) which you can then use in your code. Here's the page:
douglas clelland on 8/10/2009: If I type in a sales rep who is not on the combo list will they be automatically added to the list?
Richard Rost on 8/11/2009: Douglas, no they will not be automatically added. This is something that you'll have to code yourself, and we'll cover it in a future lesson.
Tom on 1/11/2010: But in your calculator form you did not Dim the variables in VB 101. You just typed = firstnumber, so when do you dim vs val?
Richard Rost on 1/15/2010: As long as you don't have the "option explicit" command specified, you don't HAVE to DIM your variables, although it is a good idea.
JOHNY METTA on 6/4/2010: when are gonna be more courses of vb?

Reply from Richard Rost:

Probably towards the middle of summer. I've got several other projects I need to finish first... and based on the results of the WAITING LIST, VB is not in the top couple of titles that people are most interested in.

Gborglah Isaac Ahetoh on 7/23/2012: I love learning and have your courses to be part of my life.

I really love your courses; they are very interesting and educational.

Reply from Richard Rost:

Well, thank you very much. :)

Genet Pinna on 4/2/2014: Can we write a program using ">" and "<" symbols or value?

Reply from Richard Rost:

I don't understand the question. Can you please elaborate?

Genet Pinna on 4/18/2014: I would like to learn how to implement ">" and "<" function in the program.
Brian Gillespie on 2/21/2015: As an fyi to everyone out there, make sure to enter the textbox names into the code, not the label name. Otherwise you'll be going back quite a few times to figure out where you went wrong.

Reply from Alex Hedley:

Thanks for the Tip Brian


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