Question: Working with C# Forms, trying to generate random numbers with 6 attempts for my button. If input in textbox is correct, it will show a
Working with C# Forms, trying to generate random numbers with 6 attempts for my button. If input in textbox is correct, it will show a picture of a hangman. If incorrect after 6 attempts it will display in label field. here is what I have so far;
public partial class HangMan : Form { int GuessNum;
public HangMan() { InitializeComponent(); }
private void TextBox_TextChanged(object sender, EventArgs e) { }
private void checkButton_Click(object sender, EventArgs e) // create random class, and instance of random class, pass parameters thourhg { Random Guess = new Random(); int GuessNum = Guess.Next(1,100); //GuessNum = int.Parse(TextBox.Text); TextBox.Text = GuessNum.ToString(); if (int.TryParse(TextBox.Text, out GuessNum)) { if (GuessNum >= 6) HangManPic.Visible = true; } if }
private void displayLabel_Click(object sender, EventArgs e) {
} } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
