Visual Basic allows a procedure to be repeated as many times as long as the processor could support.
A D V E R T I S E M E N T
This is generally called looping . Visual Basic supports several versions of the Do statement.
Do While loop
The Do While loop is perhaps the most common looping statement that you'll put in Visual Basic programs.
Here is the format of the Do While loop:
Do While condition
'Block of one or more VB statements
The following example shows the use of Do Loop in VB
Do while counter <=1000
The above example can be rewritten as
Loop until counter>1000
The format is as follows:
For counter=startNumber to endNumber (Step increment)
One or more VB statements
The following example shows the use of For....Next Loop in VB
(a) For counter=1 to 10
(b) For counter=1 to 1000 step 10
(c) For counter=1000 to 5 step -5