Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » special effects for hangman vb


special effects for hangman vb

Reply
  #1 (permalink)  
Old 04-21-05, 09:26 PM
ivey415 ivey415 is offline
New Member
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
special effects for hangman vb

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-24-05, 03:19 AM
rdprogrammer rdprogrammer is offline
Coding Addict
 
Join Date: Aug 2004
Location: Tulsa, Oklahoma
Posts: 250
Thanks: 0
Thanked 0 Times in 0 Posts
upload

it owuld help if you upladed the entire project file so we dont have to build a GUI
__________________
Contact me directly at:
AIM: RDProgrammer
MSN: RDProgrammer@hotmail.com
Email 1: Richard@RDProgrammer.com
Email 2: RDProgrammer@hotmail.com
Website: RDProgrammer.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free VB compiler Eclipse Visual Basic 11 06-19-05 06:06 AM
VB 6.0 and VB .NET OMID SOFT Visual Basic 2 05-25-04 03:30 PM
SQL infinite loop problem with VB application Syed Visual Basic 2 05-07-04 11:19 AM
Post URL Using VB xkenshin Visual Basic 2 01-25-04 12:37 PM
Using C DLL in VB. Function has argument with pointer to array stmoong Visual Basic 0 12-26-03 03:21 AM


All times are GMT -5. The time now is 01:34 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.