'Can someone pinpoint my error(s)
'and lead me in the right direction please.
Public Class Form1
Dim YNanswer As String = ("YesorNo")
Dim Answer As Integer 'Random Number chosen by Computer
Dim RandomNum As New Random 'Create An Instance for getting Random Numbers
Dim Guess As Integer 'The User's guess for the answer
Dim GuessCount As Integer 'Holds number of guesses the user has made.
Dim I As Integer ' Counter for number of guesses in the For Loop
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Answer = RandomNum.Next(1, 101)
I = 0
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If I > 6 Then InputBox("Sorry, Game Over!")
Do While YNanswer = (InputBox("Do You Want To Play"))
If YNanswer = "Yes" Then
InputBox("Please Enter A Number")
Guess = CInt(InputBox("Please Enter A Number"))
ListBox1.Items.Add(Guess)
If CInt(Guess) > CInt(Answer) Then InputBox("Lower!")
I = I + 1
If CInt(Guess) < CInt(Answer) Then InputBox("Higher!")
I = I + 1
If CInt(Guess) = CInt(Answer) Then InputBox("Congratulations! You Got It!")
End If
If YNanswer = "No" Then
InputBox("Are You Sure?")
If InputBox("Are You Sure?") = "Yes" Then InputBox("Okay, Your Loss...")
End If
Loop
End Sub
End Class
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>
Thanks,
PsychoCoder

New Topic/Question
Reply




MultiQuote



|