A FOR loop allows you to specify a starting value for a variable, an end value, and the amount you want to change, or increment. The first format does not specify an increment: it will increment by +1:
For <variable> = <start value> to <end value>
<statements>
Next <variable>
Double click on the form to open the code view window for the form load event. Add the code shown below:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Num As Integer
For Num = 1 To 5
lstNumbers.Items.Add(Num)
Next
End Sub
Run the program. You should see the numbers 1, 2, 3, 4, 5 in the list box.
Modify the code so that you see the numbers 0 to 10 in the list box.