Hi,

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;
                            break;
                        case 1:
                            txt2.BackColor = Color.White;
                            break;
                        case 2:
                            txt3.BackColor = Color.White;
                            break;
                        case 3:
                            txt4.BackColor = Color.White;
                            break;
                        case 4:
                            txt5.BackColor = Color.White;
                            break;
                        default:
                            pictureBox1.Image = Image.FromFile("g:\\vp\\game-easy\\images\\2.bmp");
                            break; 
                    }
                }
]
Member Avatar for iamthwee

Try asking your teacher for help. Two more days left remember. He he.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.