Show array in windows form

Updated on August 14, 2018 in [A] C# .Net
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on August 14, 2018

Hi, I’m trying to make hangman in a windows form with c#.

The player can put a letter in a textbox. After the letter is checked in the word, I want to show this letter in a label ”used letters”. I think its maybe possible with arrays but it doesn’t really work.

Example: 

word: Hello
player try: u
Output: wrong

used letters: u

 

and if the player try again it should be:

used letters: u l m i a e

 

i have this already but the letter changes when a player give a new letter:

 

private void buttonControlleerLetter_Click(object sender, EventArgs e)
        {
            string woord = textBoxWoord.Text;
            string letter = textBoxLetter.Text;
            if (woord.Contains(letter))
            {
                MessageBox.Show(“goed!”);
            }
            else
            {
                MessageBox.Show(“fout!”);
                labelGebruikteLetters.Text = textBoxLetter.Text;
            }
        }

 

  • Liked by
Reply