In Computers, apparently we have to do a Hangman program. This program is
very confusing to me, I don't understand what to do. This is my code so far,
Code:
Dim strGuessWord As String
Dim strHiddenWord As String
Dim strMusic(1 To 5) As String
Dim strMovies(1 To 5) As String
Dim strAnimals(1 To 5) As String
Dim strSports(1 To 5) As String
Dim strCountries(1 To 5) As String
Dim intLength As Integer
Private Sub cmdDisplay_Click()
intIndex = Int(Rnd * 5) + 1
Select Case intCategory
Case 1
strGuessWord = strSports(intIndex)
Case 2
strGuessWord = strMovies(intIndex)
Case 3
strGuessWord = strAnimals(intIndex)
Case 4
strGuessWord = strMusic(intIndex)
Case 5
strGuessWord = strCountries(intIndex)
End Select
intLength = Len(strGuessWord)
strHiddenWord = String(intLength, "*")
lblUserWord(1) = strHiddenWord
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdletters_Click(Index As Integer)
strUserWord = Chr(Index)
End Sub
Private Sub cmdstart_Click()
Call SelectGuess
cmdstart.Caption = "New Word"
Call EnableLetters
End Sub
Private Sub Form_Load()
strMovies(1) = "YOU GOT SERVED"
strMovies(2) = "X-MEN 2: X-MEN UNITED"
strMovies(3) = "FRIDAY AFTER NEXT"
strMovies(4) = "FREAKY FRIDAY"
strMovies(5) = "BRINGING DOWN THE HOUSE"
strMusic(1) = "KELLY CLARKSON BECAUSE OF YOU"
strMusic(2) = "EVANESCENCE MY IMMORTAL"
strMusic(3) = "KANYE WEST GOLD DIGGER"
strMusic(4) = "MARIAH CAREY SHAKE IT OFF"
strMusic(5) = "BEYONCE NAUGHTY GIRL"
strAnimals(1) = "ELEPHANT"
strAnimals(2) = "PARROT"
strAnimals(3) = "KOALA BEARS"
strAnimals(4) = "SNAKE"
strAnimals(5) = "BUFFALO"
strSports(1) = "FOOTBALL"
strSports(2) = "HOCKEY"
strSports(3) = "BASKETBALL"
strSports(4) = "TENNIS"
strSports(5) = "SWIMMING"
strCountries(1) = "CANADA"
strCountries(2) = "PORTUGAL"
strCountries(3) = "FIJI"
strCountries(4) = "SWITZERLAND"
strCountries(5) = "DENMARK"
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
End Sub
Private Sub lblUserWord_Click(Index As Integer)
strLetter = cmdletter
End Sub
And then for my option buttons, my code is as follows,
Code:
Private Sub cmdstart_Click()
frmHangman2.Visible = True
frmCategories.Visible = False
End Sub
Private Sub optAnimals_Click()
intCategory = 3
End Sub
Private Sub optCountries_Click()
intCategory = 5
End Sub
Private Sub optmovies_Click(Index As Integer)
intCategory = 2
End Sub
Private Sub optMusic_Click()
intCategory = 4
End Sub
Private Sub optSports_Click()
intCategory = 1
End Sub
And when I press the command button Display, only the number of letters in a word shows up. If you click a letter, nothing happens. Can anyone help me get this program to work? Any help is appreciated.