dalehay.com
Search Engine Optimization

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 Integer
Step 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 10
Step 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)
Step 4
The tag Next just basically says to the computer, if you haven't reached your desired number then keep going.
Next
Why 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)

Comments

Comments:

Add your comment...

Your Name:

Your Email:

Your Comment:

Enter This Number:

(13111)


Note: Your IP address is saved into the database when you submit a comment. Any type of threatening behaviour will result in your ISP being contacted and legal action being taken place!






Latest News Stories
» Peter Kay
» Not good...
» Internet Explorer 8 Problems
» October
» Relaxtion by Dale Hay
» BBC Weather Revamp
Top Viewed Stories
» PHP Mini Message Board Tutorial (4,278)
» Rare McDonalds Monopoly 2008 Tickets (3,837)
» PHP Search Engine Tutorial (2,304)
» Helen Willetts Pregnant? (1,492)
» QI Series 6 on BBC One (949)
» Create your own Image Uploader (909)
Most Commented Stories
» PHP Mini Message Board Tutorial (33)
» Create your own Image Uploader (18)
» I like my DuMP (15)
» I'm on Wikipedia! (7)
» Chocie Munchin Niece (6)
» Life on Mars... (6)