Hi there,
I'm making a Hangman game and stuck on this part:
public void Game(string letter)
{
if(word.Contains(letter))
{
int index = word.IndexOf(letter);
}
}
I am testing whether my string variable word contains a letter. If it does, it gets the index. (Yep, I used the IndexOf class) Now what I want to dos is to change a label that's on my form from _ _ _ _ _ to, for example, A _ _ _ _ where the word is actually APPLE.
In the class, I randomly select a word from an array, and put that word in a string called word. Then I set the label on my form from it's initial value "" which is nothing to a bunch of underscores, depending of course how big the word is. So if the random word is for example: Earth, then the label on the form would look like this: _ _ _ _ _.
So again, how would I go about changing the same index of the label as to the word(that's if the letter is in the word).
Help!