Zebra0.com

visual-basic loops

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: 

'Programmer: Janet Joy
'10,9,8,7,6,5,4,3,2,1,Blast OFF!
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim Num As Integer = 10
        Do
            ListBox1.Items.Add(Num)
            Num = Num - 1
        Loop Until Num = 0
        ListBox1.Items.Add("Blast OFF!")
    End Sub
End Class

NEXT: For Loops