Loops in Visual Basic

A Demo Loop Program

Create a new windows form application called loops. Add a list box listboxcalled ListBox1 (the default name) and make the height almost the height of the form.

In the properties for the list box set soprted to false. You can also do this at run time by adding the line below to Form Load:

Me.ListBox1.Sorted = False

Double click on the form to open the code view window. Write the code for the Form Load event as shown below.

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.ListBox1.Sorted = False
        For num As Integer = 0 To 5
    End Sub
End Class

The output of the program is shown below:

NEXT: For Loops