|
|
|
|
|
|
|
|
|
|
For...Next Statement
The first example is a basic counter loop. If you need to execute a certain
number of times, you can use the following:
Dim intCounter as Int32
Dim strWeekDay as String
For intCounter=1 to 7
Select Case intCounter
Case 1: strWeekDay = "Monday"
Case 2: strWeekDay = "Tuesday"
Case 3: strWeekDay = "Wednesday"
Case 4: strWeekDay = "Thursday"
Case 5: strWeekDay = "Friday"
Case 6: strWeekDay = "Saturday"
Case 7: strWeekDay = "Sunday"
End Select
Next i
The second example use the STEP function which will allow special types of
looping. You may need to count backwards, increment by a certain number, etc.
Dim intCounter as Int32
Dim strTemp as String
For intCounter=5 to 1 Step -1
Select Case intCounter
Case 5: strTemp = "Five"
Case 4: strTemp = "Four"
Case 3: strTemp = "Three"
Case 2: strTemp = "Two"
Case 1: strTemp = "One"
End Select
Next i
Copyright © 2009 RYCA Corporation. All Rights reserved.
|
|
|
|
|
|
|
|
|
|
|