I have wrote a basic hangman code in visual basic and I would like for the wrong guessess to count backwards istead of forwards from zero. I would also like to add a score label that will increment with the correct guesses and decrement with the wrong guesses. And finally change the icon to a picture in the message box. If this is possible i would like some help writting it. I am including the code I have. If you can help I would appreciate it.
Private mstrSecretW As String
Private Sub ProcessLetter(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles lblA.Click, lblB.Click, lblC.Click, lblD.Click, lblE.Click, _
lblF.Click, lblG.Click, lblH.Click, lblI.Click, lblJ.Click, _
lblK.Click, lblL.Click, lblM.Click, lblN.Click, lblO.Click, _
lblP.Click, lblQ.Click, lblR.Click, lblS.Click, lblT.Click, _
lblU.Click, lblV.Click, lblW.Click, lblX.Click, lblY.Click, lblZ.Click
Dim objLetterLbl As Label, intIndex As Integer, blnReplaced As Boolean
Dim strPartialWord, strChar As String
objLetterLbl = sender
objLetterLbl.Visible = False
strPartialWord = Me.lblSecretW.Text
For intIndex = 0 To mstrSecretW.Length - 1
strChar = mstrSecretW.Substring(intIndex, 1)
If strChar = objLetterLbl.Text Then
Mid(strPartialWord, intIndex + 1) = objLetterLbl.Text
blnReplaced = True
End If
Next
If blnReplaced = True Then
If strPartialWord.IndexOf("-") > -1 Then
Me.lblSecretW.Text = strPartialWord
Else
Me.lblSecretW.Text = mstrSecretW
MessageBox.Show("You Got It!", "Hangman", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Else
Me.lblGuess.Text = Val(Me.lblGuess.Text) + 1
If Val(Me.lblGuess.Text) = mstrSecretW.Length - 2 Then
Me.lblSecretW.Text = "Game Over"
MessageBox.Show("You Lose, the word is: " & mstrSecretW, "Hangman", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End Sub
Private Sub mmuStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmuStart.Click
lblA.Visible = True
lblB.Visible = True
lblC.Visible = True
lblD.Visible = True
lblE.Visible = True
lblF.Visible = True
lblG.Visible = True
lblH.Visible = True
lblI.Visible = True
lblJ.Visible = True
lblK.Visible = True
lblL.Visible = True
lblM.Visible = True
lblN.Visible = True
lblO.Visible = True
lblP.Visible = True
lblQ.Visible = True
lblR.Visible = True
lblS.Visible = True
lblT.Visible = True
lblU.Visible = True
lblV.Visible = True
lblW.Visible = True
lblX.Visible = True
lblY.Visible = True
lblZ.Visible = True
Dim intDashes As Integer
mstrSecretW = UCase(InputBox("Enter a word", "Hangman Game"))
If mstrSecretW.Length Then
Dim objcontrol As Control
For Each objcontrol In Controls
objcontrol.Visible = True
Next objcontrol
Me.lblSecretW.Text = ""
For intDashes = 1 To mstrSecretW.Length
Me.lblSecretW.Text = Me.lblSecretW.Text & "-"
Next intDashes
Me.lblGuess.Text = "0"
Else
MessageBox.Show("Please enter a word", "Hangman", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub mmuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmuExit.Click
Me.Close()
End Sub
End Class