Lucky 7 Application

Topic Progress

This program creates 3 random numbers between 1 and 7. If any of the number s are 7 a ‘lucky’ image is revealed






you will need:

  • 1 button
  • 3 labels
  • 1 pictureBox
1
2
3
4
5
6
7
8
9
10
  PictureBox1.Visible = False  ' hide picture
        Label1.Text = CStr(Int(Rnd() * 10))  'pick numbers
        Label2.Text = CStr(Int(Rnd() * 10))
        Label3.Text = CStr(Int(Rnd() * 10))
        'if any number is 7 display picture and beep
        If (Label1.Text = "7") Or (Label2.Text = "7") _
        Or (Label3.Text = "7") Then
            PictureBox1.Visible = True
            Beep()
        End If

Code Challenge

  • Add a green lucky 3 leaved Irish Clover as the image
  • Add another pictureBox with an unlucky image that is revealed if the number 3 is revealed and change the code for this
  • Add a super lucky pictureBox if 2 number 7’s are generated