34,333
edits
Changes
New page: Often when looping it is not possible to know in advance how many times the loop needs to be performed. For example, a loop may need to continue until some specific criteria are met. Under...
Often when looping it is not possible to know in advance how many times the loop needs to be performed. For example, a loop may need to continue until some specific criteria are met. Under such circumstances the Visual Basic ''Do ... Loop'' structure is used.
== Creating a Visual Basic Do ... Loop ==
The Visual Basic ''Do ... Loop'' structure can be used in a variety of different ways. The first, basic method involves a simple Do loop with an Exit statement called based on a ''If'' statement. The syntax for this type of Do Loop is as follows:
'''Do'''
''[VB Statements]''
'''If''' ''expression'' '''Then Exit Do'''
'''Loop'''
== Creating a Visual Basic Do ... Loop ==
The Visual Basic ''Do ... Loop'' structure can be used in a variety of different ways. The first, basic method involves a simple Do loop with an Exit statement called based on a ''If'' statement. The syntax for this type of Do Loop is as follows:
'''Do'''
''[VB Statements]''
'''If''' ''expression'' '''Then Exit Do'''
'''Loop'''