Zebra0.com

visual-basic examplesProfessor Joy: CMSC222 Class Work

Professor Joy: CMSC222 Class Work

Animals in Array

All of the animals are in an array. When the timer goes off, the next animal is displayed in the text.
Public Class Form1
    Dim animals() As String = {"dog", "elephant", "frog", "horse"}
    Dim Num As Integer = 0
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = animals(2)
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Num = Num + 1
        If Num >= animals.Length Then
            Num = 0
        End If
        Me.Text = animals(Num)
    End Sub
End Class

This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.