Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Guessing Game

Status
Not open for further replies.

Crazier

Programmer
Apr 24, 2002
10
US
I have written this code for a guessing game but it doesn't clear the message box to allow for a new guess.
Any suggestions would be appreciated.
Dim intIndex As Integer
Dim intGuess As Integer
Dim intIndexCount As Integer
intIndexCount = 1
intGuess = txtGuess
Do While intGuess <> intIndex
intIndex = Rnd * 12
If intGuess < intIndex Then
MsgBox &quot;I am sorry your guess is too low&quot;, vbRetry, &quot;Too Low&quot;
intGuessCount = intGuessCount + 1
txtGuess.Text = &quot;&quot;
ElseIf intGuess > intIndex Then
MsgBox &quot;I am sorry your guess is too low&quot;, vbRetry, &quot;Too Low&quot;
intGuessCount = intGuessCount + 1
ElseIf intGuess = intIndex Then
MsgBox &quot;Your right&quot;, vbRetry, &quot;WoW&quot;
intGuessCount = intGuessCount + 1
End If
Loop
Thanks for any help you can offer
 
Hi,

You use txtGuess.Text =&quot;&quot; after the first msgbox not the other two

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top