Writing Code in Visual Basic

Create this program:

  1. Download the cat and dog pictures, or use your own.
  2. Build the form as shown in the video.
  3. Write the code as shown below.
'Programmer: Janet Joy
'Show picture of dog or cat
Public Class Form1
    Private Sub BtnDog_Click(sender As Object, e As EventArgs) Handles BtnDog.Click
        'Hide the cat, show the dog
        Me.PicCat.Visible = False
        Me.PicDog.Visible = True
    End Sub

    Private Sub BtnCat_Click(sender As Object, e As EventArgs) Handles BtnCat.Click
        'show the cat, hide the dog
        Me.PicCat.Visible = True
        Me.PicDog.Visible = False
    End Sub
End Class

NEXT: Selecting Events