Start New Discussion within our Software Development Community


I need to create a program: Hangman.

So far we have seen arrays and functions in class but I don't know how to translate the logic into the code.

My program has to take the words from an array and randomly select one.

The user is to enter the letter into a textbox, click the button "check" and if its correct change the color the textbox to reveal the letter the user guessed (my array program should also send each letter of the word to a different textbox where the letter has a blue color and the textbox has the background color set to blue). If the user guesses the letter the background would change to white and you'll be able to see the letter.

I'm stuck with the array, please help me. I have 2 days to present it:cry::sad:

I'm using s switch to decide whether or not you guessed a letter.

[if (guess.Equals(myCharArray))
                    switch (counter)
                        case 0:
                            txt1.BackColor = Color.White;
                        case 1:
                            txt2.BackColor = Color.White;
                        case 2:
                            txt3.BackColor = Color.White;
                        case 3:
                            txt4.BackColor = Color.White;
                        case 4:
                            txt5.BackColor = Color.White;
                            pictureBox1.Image = Image.FromFile("g:\\vp\\game-easy\\images\\2.bmp");
This article has been dead for over six months. Start a new discussion instead.