1. Add in a label to say if the second player's guess was too high or too low
2. The challenger is only suppsoed to put a num between 1 to 10, but when they do, my program does not stop them. I don't know what to do
3. To add in a list of the second players previous guesses to help them with the guesses
4. Add a feature to the program to keep a running score of the number of games the player has won or lost
Also, I think i have made an error in the program, so when the the game is replayed not all of the Label/cmd/txt components are reset properly. How do I correct this?
This is my program so far.
[ Public Class Form1
Dim Number As Integer
Dim GuessCount As Integer
Private Sub cmdAcceptNumber_Click(sender As System.Object, e As System.EventArgs) Handles cmdAcceptNumber.Click
Label1.Visible = False
Number = txtNumberBox.Text
txtNumberBox.Visible = False
cmdAcceptNumber.Visible = False
txtGuess.Visible = True
Label2.Visible = True
cmdAcceptGuess.Visible = True
txtGuess.Focus()
End Sub
Private Sub cmdExit_Click(sender As System.Object, e As System.EventArgs) Handles cmdExit.Click
End
End Sub
Private Sub cmdAcceptGuess_Click(sender As System.Object, e As System.EventArgs) Handles cmdAcceptGuess.Click
Dim Guess As Integer
Dim msg As String
Guess = txtGuess.Text
GuessCount = GuessCount + 1
If Guess = Number Then
msg = "Well done you guessed it in " & GuessCount & " guesses"
MsgBox(msg, , "Game Result = Challenger Wins")
ResetGame()
Exit Sub
Else
If GuessCount = 7 Then
Label3.Text = "No more guesses"
MsgBox("You lose - too many guesses", , "Game Result = Challenger loses!")
ResetGame()
Exit Sub
End If
End If
Label3.Text = "Guesses left: " & 7 - GuessCount
txtGuess.Focus()
txtGuess.Text = ""
End Sub
Private Sub ResetGame()
Label1.Visible = True
txtNumberBox.Text = ""
txtNumberBox.Visible = True
cmdAcceptNumber.Visible = True
txtGuess.Visible = False
Label2.Visible = False
cmdAcceptGuess.Visible = False
txtGuess.Text = ""
GuessCount = 0
End Sub
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
txtGuess.Visible = False
Label2.Visible = False
cmdAcceptGuess.Visible = False
End Sub
End Class ]
This post has been edited by modi123_1: 26 February 2013 - 06:46 PM
Reason for edit:: use code tags

New Topic/Question
Reply



MultiQuote









|