How do you program Hangman in VB 2008, word length problem?

How do I program hangman with out exact letter lengths? I can get the program to work by using an exact length of words, but in this instance I need it to program UP TO a maximum of 10 letters, so it could be a 5 letter word or a 3 letter word or a 7 letter word and I don't know how to program it that way. I'm no where near a programmer and this is my first class that I have taken with programming. I have struggled with this class the whole time I have been in it and the book we have doesn't give the best examples or describe things in depth very well. How do I make this game work with a maximum of 10 letters?


Show us some of your code. I think I am following you, but you didn't really give enough detail about your requirements or how you are implementing it as of now. Why is the maximum of 10 letters a problem for you? Give a bit more info and I know I can help.

Edit:

'get a 10-letter work from player 1, convert to uppercase
strWord = InputBox("Enter a 10-letter word:", _
"Hangman Game").ToUpper------------> That is correct.

'determine whether the word contains 10 letters
blnValidWord = True 'assume the word is valid----->That is fine.
If strWord.Length <> 10 Then

----->You are stating that you will only allow a number that is 10 characters long. What you want is a MAX of 10 characters. So heres what you should do:

If strWord.Length >10 Then

------> if strWord is greater than 10 characters, then blnValidWord is false

blnValidWord = False
Else

Dim intIndex As Integer ---> Dim all variables at the beginning of your subprocedure, not in the middle like this.

Do While intIndex < 10 And(--->"Also" should not be used) blnValidWord = True

If strWord.Substring(intIndex, 1) Like "[A-Z]" Then
blnValidWord = False -----> Wouldn't you want this to be true if the string contains characters [A-Z]?

End If
intIndex = intIndex + 1 ----> Could also use intIndex += 1
Loop
End If

'if the word is not valid, display a message
If blnValidWord = False Then
MessageBox.Show("10 letters are required.", _
"Hangman Game", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
----> You could just use MsgBox("your text") in this instance.

As another tip, I would put the letters in an array while you are evaluating their validity if you plan to make a functional hangman game. Arrays would make this quite simple.
I did not point out all of the problems since it seems you are trying to learn VB, so let's see if you can finish it from here. If you have more questions, feel free to ask me.




What are easy games like Tic-tac-toe and hangman? (I just need like 5 games, cards, pencil and paper)?

OK.
The question is simple ^^
So the more games (that young kids can play, and it's easy to explain) you

What are some fun games to play via email?

My girlfriend and I both have boring 9-5 office jobs, so we email each other back and forth all day.

We're

HANGMAN HELP PLS!!!!!!?

Ok so the clue so far is:

NO_ _A-N_ _

(note it is hyphenated!)

and it is partially black?!?!

the

How many letter guesses does a person get in a game of hangman?

Does any know anything about ALFRED ALLEN the hangman from wolverhampton who died around 1938?

he was on the list of hangmen from 1930 until 1938 and lived in Park Street South in Wolverhampton

Need 4 letter word answer for hangman...?

what is this 4 letter word, fill in the blank!

A_AN

Guess who I am........................hangman?

--- ---- ---- ------ ---- ----

there's five letters in my name pick a letter and if it's there