Visual Basic: Data Types
Posted: January 31st, 2012 | Author: Brian Martin (BlinkBrian) | Filed under: Visual Basic Tutorial (Series) | No Comments »In the last tutorial, we learn’t Visual Basic Input Operators and Variables.
Let’s create a simple program that allows the user to enter two numbers and that displays the total sum of both numbers.
Program
- Open a new project and save it as “AddingNumbers”
- Type in the following code into the text editor
Console.Write(“First Number: “)
Dim a As Integer = Console.Readline
Console.Write(“Second Number: “)
Dim b As Integer = Console.Readline
Dim c As Integer = a + b
Console.Writeline (c)
Console.Readline()
Test
- Press F5 to run the program
All computer programs consists of
Input – The information that the user enters
Process – The calculations the program needs to perform
Outputs – The values the program displays to the user
| Inputs | Processes | Outputs |
| A B |
c = a+b | C |
Okay – Now it’s your turn to do something.
Test the program by using the following input data:
A = 33.3
B = 2
What do you get?
Test your program by using input data A = h and b = w
What is the result?
It’s all good just learning what is in these tutorials, but you really need to learn by trying different things and failing you learn how Visual Basic works.
Next we’re going in with Visual Basic String, Integer and Double Data types.

Leave a Reply