The Do Loop is similar to the While loop except that it does the test at the end of the loop. A do loop executes one or more times. The format of a Do Until loop is:

Do
<statements>
Loop Until <Boolean expression>

 blast off

Example: 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim Num As Integer = 10
    Do
       lstNumbers.Items.Add(Num)
       Num = Num - 1
    Loop Until Num = 0
    lstNumbers.Items.Add("Blast OFF!")
End Sub

INDEX, A Demo loop program, For Loops, Step: change the increment, While Loops, While, cont., Endless loops, Do Loops, Nested Loops, For Each Loops, Graphics with Loops
Next lesson: Arrays in Visual Basic

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Do Loops