Windows 10 Coming Soon
Tips & Tricks
Windows Forum
Course Index
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > Courses > Visual Basic > VB 6 > 102 > Introduction < 102 | Lesson 01 >
Introduction

Welcome! If Then Else, Input & Combo Boxes


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark 

In this lesson, we will introduce Visual Basic 102 using Visual Basic. We will review objectives such as expanding the IF-THEN statement with ELSEIF and ELSE clauses, getting user input through input boxes, letting users select options with combo boxes, discussing variables for storing information, generating random numbers, commenting code, and using FOR loops. We will talk about creating an image viewer and building a simple loan calculator. This lesson recommends prior completion of Visual Basic 101 and will use Microsoft Visual Basic along with Windows, but the content applies to most versions.

Navigation

Keywords

, Visual Basic 6, IF THEN ELSE, input box, combo box, variables, random numbers, comment code, FOR loop, image viewer, loan calculator, VB.NET, Visual Basic 5, Windows application, ELSEIF, user input, temporary information

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Introduction
Get notifications when this page is updated
 
Intro In this lesson, we will introduce Visual Basic 102 using Visual Basic. We will review objectives such as expanding the IF-THEN statement with ELSEIF and ELSE clauses, getting user input through input boxes, letting users select options with combo boxes, discussing variables for storing information, generating random numbers, commenting code, and using FOR loops. We will talk about creating an image viewer and building a simple loan calculator. This lesson recommends prior completion of Visual Basic 101 and will use Microsoft Visual Basic along with Windows, but the content applies to most versions.
Transcript Welcome to Visual Basic 102 using Visual Basic, brought to you by 599CD.com. I am your instructor, Richard Rost.

Let's go over the objectives for today's class. We are going to expand upon some of the stuff that we learned in VB 101, like the IF-THEN statement. We are going to expand it to include the ELSEIF and ELSE clauses today.

We are going to teach you how to get input from the user in the form of an input box. We will teach you how to let your users select from a list of options using a combo box.

We are going to talk about variables and how they work to store temporary information in the computer's memory. We will teach you how to generate random numbers. We will show you how to properly comment your code.

We will learn how to use a FOR loop to loop through numbers. We will have some fun creating an image viewer. And we are going to build a simple loan calculator at the end of class.

This class does have a prerequisite of Visual Basic 101. We strongly recommend that you take VB 101 before taking this class. If you have not taken VB 101 yet, head on over to 599city.com to get your copy.

In this class, we are going to use Microsoft Visual Basic 6.0, along with Windows XP. This course is valid for any version of Windows. It does not matter what version of Windows you have. If you are using Visual Basic 5, you should not notice much of a difference at all.

Likewise, VB.NET users should also be able to use the lessons in this course. Just make sure that you are using a Windows application.
Quiz Q1. What is an expansion of the IF-THEN statement discussed in this class?
A. Adding ELSEIF and ELSE clauses
B. Using SELECT CASE instead of IF-THEN
C. Removing all conditional statements
D. Replacing IF-THEN with DO WHILE

Q2. How will you learn to get input from the user in this class?
A. Through an input box
B. By reading from a file
C. Using a text file
D. With command line arguments

Q3. What control allows users to select from a list of options as discussed in this lesson?
A. Combo box
B. Radio button
C. ListView
D. Text box

Q4. What is the main purpose of using variables in Visual Basic as described?
A. To store temporary information in memory
B. To display images
C. To create user interfaces
D. To write comments in code

Q5. Which programming feature will be used to loop through numbers in this class?
A. FOR loop
B. DO UNTIL loop
C. SELECT CASE
D. WHILE WEND

Q6. What kind of application will you create to work with images?
A. An image viewer
B. A video editor
C. A word processor
D. A music player

Q7. What simple practical application will you build by the end of the class?
A. A loan calculator
B. A weather app
C. A calendar planner
D. A stopwatch

Q8. What should you do before taking this class according to the instructor?
A. Take Visual Basic 101
B. Install Microsoft Publisher
C. Learn C++
D. Buy a new computer

Q9. Which version(s) of Windows is this course valid for?
A. All versions of Windows
B. Only Windows XP
C. Only Windows 98
D. Only Windows 7

Q10. Which programming language are the lessons focused on in this course?
A. Visual Basic
B. C#
C. Java
D. Python

Q11. What should VB.NET users ensure when following along with this course?
A. They are using a Windows application
B. They are working online
C. They use Linux
D. They are using Python

Answers: 1-A; 2-A; 3-A; 4-A; 5-A; 6-A; 7-A; 8-A; 9-A; 10-A; 11-A

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Welcome to Visual Basic 102, part of my Visual Basic course series here at 599CD.com. I am Richard Rost, your instructor for this class.

Today, we are going to build on the foundational topics from Visual Basic 101. If you have not completed that course yet, I strongly recommend you do so first, as we will be extending those fundamental concepts in this class.

One of the first things we will cover is working with more advanced IF-THEN statements by adding ELSEIF and ELSE clauses. This will allow for more flexible decision making in your programs.

Next, I am going to show you how to prompt users for input using an InputBox, and how to provide them with a list of selectable options through a combo box. These techniques are essential for making interactive applications.

We will also talk about variables and their important role in storing temporary data in your computer's memory while your program runs. You will learn about generating random numbers, which can be useful for a wide range of applications.

Properly commenting your code is another key topic we will discuss, ensuring that your programs remain understandable both to you and to others who may read your code in the future.

I will introduce you to the FOR loop, a fundamental tool for repeating actions a specified number of times. We will put this into practice with hands-on examples.

Later in the class, we will create a simple image viewer to help illustrate these programming concepts, and we will wrap up by building a basic loan calculator.

For this course, I will be demonstrating everything using Microsoft Visual Basic 6.0 on a Windows XP system. However, these lessons apply to any version of Windows. If you are working with Visual Basic 5, you should not notice any substantial differences in the material. VB.NET users can also follow along, provided you are working with a Windows application.

You can find the complete step-by-step video tutorial for everything we discuss here today on my website, linked below.

Live long and prosper, my friends.
Topic List IF-THEN statement review
Using ELSEIF and ELSE clauses
Getting user input with InputBox
Using a combo box for user selections
Understanding and using variables
Generating random numbers
Commenting your code
Using FOR loops to iterate numbers
Creating an image viewer application
Building a simple loan calculator
Article Welcome to this Visual Basic tutorial, where we will build on some foundational concepts and introduce a few new ones. In this lesson, you will learn how to enhance your programs using control statements, user input, list selection, variables, and more. By the end, you will have the skills needed to create practical applications such as an image viewer and a loan calculator.

Let's start by extending the IF-THEN statement. In Visual Basic, the IF-THEN statement allows your code to make decisions based on certain conditions. For example, a simple IF-THEN might look like this:

If score >= 60 Then
MsgBox "You passed!"
End If

But sometimes, you need to handle more than two possibilities. This is where ELSEIF and ELSE come in. Here is how you can use them:

If score >= 90 Then
MsgBox "Excellent!"
ElseIf score >= 60 Then
MsgBox "You passed!"
Else
MsgBox "Sorry, you failed."
End If

This structure lets your program branch into different outcomes as needed.

Next, you will learn how to get input from the user. One way to do this is with the InputBox function. This function will display a prompt and let the user type a response. For example:

Dim userName As String
userName = InputBox("What is your name?")
MsgBox "Hello, " & userName

If you want users to select from a set of options, a combo box is ideal. Combo boxes display a dropdown list, allowing users to pick one item. To use a combo box in your form, add it from the toolbox, and populate it with items like this:

ComboBox1.AddItem "Red"
ComboBox1.AddItem "Green"
ComboBox1.AddItem "Blue"

Then, you can check the user's selection with:

MsgBox "You selected " & ComboBox1.Text

Variables are essential for storing information temporarily while your program is running. You declare a variable with the Dim statement. For example:

Dim total As Double
total = 123.45

Variables can store numbers, text, or other data types.

Random numbers are useful in many applications, such as games or utilities. To generate a random number between 1 and 100, use this code:

Dim i As Integer
i = Int((100 - 1 + 1) * Rnd + 1)
MsgBox i

Make sure to use the Randomize statement before generating numbers if you want different results each time your program runs:

Randomize

Commenting your code is an important habit to develop. Comments do not affect how your program runs, but they help you and others understand what your code does later on. In Visual Basic, you start a comment with an apostrophe like this:

' This is a comment

Now let's look at repeating actions using a FOR loop. A FOR loop is a convenient way to execute a block of code multiple times. Here is an example that counts from 1 to 10:

Dim i As Integer
For i = 1 To 10
MsgBox i
Next i

Next, creating an image viewer is a fun way to practice working with forms and controls. Place an Image control on your form, and add buttons to browse through pictures. For instance, you could load an image like this:

Image1.Picture = LoadPicture("C:\Pictures\photo1.jpg")

You can add buttons to move to the next or previous image by changing the file path in the above code.

Finally, building a simple loan calculator is a practical project. You can prompt the user for the loan amount, interest rate, and number of payments using InputBox or text boxes. Then, use a formula to compute the monthly payment. For example:

Dim loanAmount As Double
Dim interestRate As Double
Dim numPayments As Integer
Dim monthlyPayment As Double

loanAmount = Val(InputBox("Enter the loan amount:"))
interestRate = Val(InputBox("Enter the annual interest rate (as percent):")) / 100 / 12
numPayments = Val(InputBox("Enter the number of monthly payments:"))

monthlyPayment = loanAmount * interestRate / (1 - (1 + interestRate) ^ -numPayments)
MsgBox "Your monthly payment is " & Format(monthlyPayment, "Currency")

The concepts and techniques you learn in this lesson work across all versions of Visual Basic and in any standard Windows environment. You can use these skills to enhance almost any application, both for work and for fun projects. Remember to experiment and practice. The more you use these tools, the more comfortable you will become creating your own Visual Basic applications.
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/30/2026 5:37:24 AM. PLT: 1s
Keywords: , Visual Basic 6, IF THEN ELSE, input box, combo box, variables, random numbers, comment code, FOR loop, image viewer, loan calculator, VB.NET, Visual Basic 5, Windows application, ELSEIF, user input, temporary information  PermaLink  How To Use IF THEN ELSE, Input Boxes, Combo Boxes, Loops, and More in Visual Basic