Arrays in Visual Basic

The program below prints the words zero, one, two, three, … ten. The array is declared at the top to make it global. It is given initial values in form load. A for loop is used to print each element in the array, starting with 0.

'Illustrate arrays
Public Class Form1
    'Programmer: Janet Joy
    Dim English(10) As String 'global
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Initialize array
        English(0) = "zero"
        English(1) = "one"
        English(2) = "two"
        English(3) = "three"
        English(4) = "four"
        English(5) = "five"
        English(6) = "six"
        English(7) = "seven"
        English(8) = "eight"
        English(9) = "nine"
        English(10) = "ten"
    End Sub

    Private Sub Form1_MouseClick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
        'Prints the words zero, one, two, three, … ten when the user clicks
        Dim MyBrush As New SolidBrush(Color.Black)
        Dim N As Integer
        For N = 0 To 10
            Me.CreateGraphics.DrawString(N, Me.Font, MyBrush, 0, N * 15)
            Me.CreateGraphics.DrawString(English(N), Me.Font, MyBrush, 15, N * 15)
        Next N
    End Sub
End Class

NEXT: Example 1: Initialize