Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
Dim guess As Integer
Randomize()
' Generate random value between 1 and 100.
Dim x As Integer = CInt(Int((100 * Rnd()) + 1))
guess = CInt(txtGuess.Text)
If guess = x Then
lblHiOrLow.Text = "You guessed it!"
Else
If guess > x Then
lblHiOrLow.Text = "Guess Lower"
Else
lblHiOrLow.Text = "Guess Higher"
End If
End If
Static intCount As Integer
intCount = intCount + 1
If intCount = 1 Then
lblNumber.Text = "You've guessed " & intCount & " time."
Else
lblNumber.Text = "You've guessed " & intCount & " times."
End If
End Sub
In other words the number keeps changing so obviously its a little hard to guess. How do I get the number then store it?
2007-03-08
12:22:10
·
1 answers
·
asked by
Daddyhorhay
1
in
Computers & Internet
➔ Programming & Design