Seasons
We will end the lesson on code by writing a program that displays a picture and information about each season. Start a new windows application named Seasons. Right click on each picture and save it to your computer:


Build the form as shown below:
- Add a label
and name it LblMessage.
- Add four buttons
named BtnSpring, BtnSummer, BtnFall, and BtnWinter. Set the text and BackgroundColor as shown in the illustration.
- Add four picture boxes
named PicSpring, PicSummer, PicFall, and PicWinter.
- Select the background image for each one using the appropriate picture. Set autosize to true to make the picture exactly fit.
- Place all of the picture boxes on top of each other so that they will appear in the same spot.
Double-Click on BtnSpring to open the code view window. Write the code as shown below:
Private Sub BtnSpring_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSpring.Click
Me.BackColor = sender.backcolor
Me.PicSpring.Visible = True
Me.PicSummer.Visible = False
Me.PicFall.Visible = False
Me.PicWinter.Visible = False
Me.LblMessage.Text = "Spring: The snow melts and flowers bloom."
End Sub 'BtnSpring_Click
Finish the program by copying the code and pasting it for each button, then modify.
INDEX,
The Code View,
Selecting code from list,
Events,
Arguments,
Concatenation,
Sender,
Scroll Bars,
Decimal Values on Scroll Bar,
Picture Boxes: the Seasons,
Comments, Printing, ClosingNext lesson:
Functions in Visual Basic