Do-Loop construct is used when we do not know how many iterations will be performed , where as when we know exact number of execution on the block of code, For-Next construct is used. To use this construct we have to use a counter.
We will always loop from some starting value to some end value. By default a For-Next loop always increment by one every time through the loop. The format of the For-Next statement is as follows :
For intCounter = intStart to intend
[Step in Increment]
Next[intCounter]
To do first iterations intCounter is initialized to intStart value. When execution reaches to next statement it will increment the value of counter by one & control will again go to the fist statement. If the value of intStart is less than intend, second iteration will occur and so on. This is how the for-loop will execute. By Default if we do not write step , it will increment intCounter by one. If we want to increment value of intCounter while value of step other than one then we have to write step statement with which we will tell VB to increment value with specified number of steps for each interations.
Ex. For intCounter = 1 to 5
Form1.Print intCounter
Next
Ex. For intCounter = 0 to 10
Step 2
Form1.print intCounter
Next