Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio .NET
Reference
Control Flow
Loop Structures

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
Visual Basic Language Concepts
Loop Structures

Loop structures allow you to execute one or more lines of code repetitively. You can repeat the statements until a condition is true, until a condition is false, a specified number of times, or once for each object in a collection. The loop structures supported by Visual Basic include:

  • While
  • Do...Loop
  • For...Next
  • For Each...Next

In This Section

While Statement
Describes how to execute a block of statements while a condition is true.
Do...Loop Statements
Describes how to execute a block of statements until a condition is satisfied.
For...Next Statements
Describes how to execute a block of statements a specified number of times.
For Each...Next Statements
Describes how to execute a block of statements for each element in a collection.
Faster For...Next Loops
Explains how to optimize performance of loops.

Related Sections

Decision Structures
Explains control-flow statements used for branching.
With...End With Statements
Describes how to execute several statements on the same object.
Nested Control Statements
Explains control-flow statements inside other control-flow statements.
Exit Statement
Shows how to transfer control directly out of a control-flow statement.
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker