![]() ![]() You are generating the random number every loop, meaning that rather than there being a fixed number that you are trying to guess, the number is changing.Įven if you are defining the random number outside the loop, the number changes every time that you click the button. ![]() There are quite a few errors with your code: Private Sub btnGuess_Click(sender As Object, e As EventArgs) Handles btnGuess.Click Private Sub btnNew_Click_1(sender As Object, e As EventArgs) I'm not quite sure what the error in the code is but whenever I hit "Display" the guess count is a very high number and the message shown in the label is always just "Correct.", so my question is how do I fix this and write the loop correctly? LblResponse.Text = "Too high, try again." The program also counts the number of guesses you've made.Īnd here is the code I have so far: Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click Basically, you input a number as a guess and the program will display a message telling you whether the guess is too high, too low, or correct, and it will loop until you get the guess correct. I'm trying to create a random number guessing game that must have a loop. I need some help for an assignment in class. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
May 2023
Categories |