title: Clearing out a c# form text box
body: <p>I am making a simple hangman style game in a C# form. I have it set as textBox1_TextChanged. Except everytime the user backspaces their guess letter it takes in blank space. How can I make it so after the message saying right/wrong it clears the space. I am getting annoyed at it telling the user they made a wrong guess after they backspace. This is my first post on this forum so sorry if the code text is weird. I just want the program to clear the text in the textBox after they guess.</p>
  
  <p>UPDATE: Added suggested information. Now it does everything it is supposed to do. Except it pops up a windows saying "  was found in the target word". This happens if guessLetter == null || guessLetter == correct || guessLetter == false.</p>
  
  <pre><code>private void textBox1_TextChanged(object sender, EventArgs e)
      {
          string guessLetter = textBox1.Text;
          //textBox1.ReadOnly = true;
  
  
          if (targetWord == null)
          {
              MessageBox.Show("Please start a new game.");
              textBox1.Text = ("");
  
          }
  
          else
          {
              if (targetWord.Contains(guessLetter))
              {
  
  
                  MessageBox.Show(guessLetter + " was found in the word");
              }
  
              else
              {
                  MessageBox.Show(guessLetter + " was not found in the word");
                  incorrectGuessCtr++;
                  textBox3.Text = incorrectGuessCtr.ToString();
              }
              textBox1.Text = ("");
          }
      }
  </code></pre>