34,333
edits
Changes
→Creating a Visual Basic For Loop
The Visual Basic ''For'' loop is ideal for situations wheer a task needs to be performed a specific number of times. For example, perhaps a value needs to be added to a variable 100 times. A Visual Basic ''For'' loop consists of a header, a code block and a next statement. The header copntains information about how many time the loop is to be performed, the code block contains the statements to be executed on each iteration and the next statement sends the loop back to the header to repeat. The syntax of a ''For'' loop is as follows:
'''For''' ''counterVariable'' '''=''' ''fromValue'' '''To''' ''toValue''<br>''VB Statements''<br>'''Next''' ''counterVariable''<br>