hi, im using microsoft visual studio to make a game the game consists of a random number generator which ive completed and is working fine, when it generates a 7 a message tells you that you have a lucky seven, you get five goes at this then a message tells you that the game is over, all of this is working fine, my problems started when i tried to include a play again button that allows the user to have another five goes, ive got the button included in the form but dont know what code i should use so that it allows the user to play again, sorry if ive been kind of vague here but im new to all this, any help would be gratefully apprieciated, thanks

I don know what are you doing till the user gets a "Game Over"
Are you summing up the points? If so when the user gets a "Game Over" or the user's 5 "go"s are over.
1. Just display the user's points in a message box.
2. Disable the generator buttons.

and when the user clicks the "Play Again" button
1. Reset the points counter
2. Reset the turn counter "user's goes" to 1 so that the user starts the game again
2. Enable the generator button

Well, this is simple. Am assuming you are a beginner. There are more advanced things u can do like storing the high score, promptin user about the highscore....

Hope this is wat you asked for....

Comments
Well explained.

or maybe this could give you an idea.

dim x as string
If text1.value = 5 Then
    x = MsgBox("Play Again?", vbYesNo + vbQuestion, "Continue")
            If x = vbYes Then
                text1.text = Empty
                command1.enabled = true

            End If
End If
This article has been dead for over six months. Start a new discussion instead.