Incrementing variables in a programming language is one of the first tasks you will be required to learn. When writing your programs in Visual Basic .Net, incrementing the integer data type will be necessary. Controlling of loops is a common use of the variable incrementing, and keeping count of items in your program is another. Use your imagination when coding to solve problems using variables that you increment by 1 or more.
- Skill level:
Other People Are Reading
Things you need
- Microsoft Visual Basic 2003 or later
Click the "Start" icon located on the Windows taskbar and select "Visual Basic."
Select "File" and "New Project" from the Visual Basic taskbar.
Select the "Windows Form Application" icon and click the button labelled "OK."
Select the "Button" icon located in the "Tool Box" window. Click in the window labelled "Form1" and draw a button control.
Double-click on the button labelled "Button1" to open the code window for the button control.
Insert the following text below the line, starting with "Private Sub Button1_Click":
Dim a As Integer
a = 0
While a < 5
a = a + 1
Press the "F5" key to execute the code, and click on the button labelled "Button1." A window will display with the number "5," showing the incremented value of the variable "a." Click the button "OK" to end the program.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for