For Loop in vb.NET 2003
Digg! This Page
Not really a big tutorial, but a little helpfulness to those who need to know how to do a For Loop in Visual Basic .NET 2003.Step 1
We are currently telling the computer that the varible myNum is going to be a integer (number).
Dim myNum As IntegerStep 2
Now the varible myNum will be given the task to do something as it's value is 1, till it reaches 10.
For myNum = 1 To 10Step 3
Presuming you'll use this loop on a listbox, the varible myNum will loop itself 10 times with its value in the listbox.
ListBox1.Items.Add(myNum)
The tag Next just basically says to the computer, if you haven't reached your desired number then keep going.
NextWhy Use It?
Many people would ask this question, but to be honest it is such an easier way than writing
ListBox1.Items.Add(1) ListBox1.Items.Add(2) ListBox1.Items.Add(3) ListBox1.Items.Add(4) ListBox1.Items.Add(5) ListBox1.Items.Add(6) ListBox1.Items.Add(7) ListBox1.Items.Add(8) ListBox1.Items.Add(9)



