Visual Basic Express 2008 Help

Posted by khalidfazeli on Stack Overflow See other posts from Stack Overflow or by khalidfazeli
Published on 2010-04-26T13:51:03Z Indexed on 2010/04/26 13:53 UTC
Read the original article Hit count: 255

I have been given a task to:

Develop a program where a child will be presented with picture of a fruit (one of five possible fruit) on the screen at the click of a start button. The child will then try to recognise the fruit and write its name in a specified place on the screen. On the click of a check button the name of the fruit written by the child will be checked by your program and if correct will reward the child with a suitable message. If the name presented by the child is not correct, a suitable message should be presented on a red background with the correct name of the fruit included in the message.

so far I have managed to create a form with 5 different fruit pictures and a text box below them. a button at the bottom of the form then checks the results and presents a message box to tell them if they have passed or failed.

Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResults.Click
    If txtApple.Text = "APPLE" And txtOrange.Text = "ORANGES" And txtStrawberry.Text = "STRAWBERRIES" And txtGrapes.Text = "GRAPES" And txtBanana.Text = "BANANAS" Then
        MsgBox("Congratulations! you got it all right!", MsgBoxStyle.OkOnly)
        End
    Else
        MsgBox("Incorrect, please try again", MsgBoxStyle.OkOnly)
        End
    End If
End Sub

but I can't get it to randomise the picture of the fruit, so it only displays one fruit at a time and checks against it.

Any help is appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about visual-basic

Related posts about visual-studio-2008