Create Hang Man Game in Visual Basic 6

   

    ———————————————–

    Dim i As Integer: i = 1
    Dim isCorrectWord As Boolean: isCorrectWord = False
    Dim MyWord As String
   
    While Mid(MyStr, i, 1) & “” <> “”
        If Mid(MyStr, i, 1) = Right(txtLetter.Text, 1) Then
           MyWord = MyWord & Right(txtLetter.Text, 1)
           If Mid(lblWordGuess.Caption, i, 1) <> _
              Right(txtLetter.Text, 1) Then _
                isCorrectWord = True
        Else
            MyWord = MyWord & Mid(lblWordGuess.Caption, i, 1)
        End If
        i = i + 1
    Wend
    txtTotalGuess = txtTotalGuess + 1
    If Not isCorrectWord Then
        txtWrongGuess = txtWrongGuess + 1
        If txtWrongGuess = 1 Then shapeHead.Visible = True
        If txtWrongGuess = 2 Then
           lineEye1.Visible = True: lineEye2.Visible = True
           lineEye3.Visible = True: lineEye4.Visible = True
           lineNose.Visible = True: lineMouth.Visible = True
        End If
        If txtWrongGuess = 3 Then lineNeck.Visible = True
        If txtWrongGuess = 4 Then lineHandL.Visible = True
        If txtWrongGuess = 5 Then lineHandR.Visible = True
        If txtWrongGuess = 6 Then lineBody.Visible = True
        If txtWrongGuess = 7 Then lineLegL.Visible = True
        If txtWrongGuess = 8 Then lineLegR.Visible = True
    End If

—————————————————

អានលម្អិតនៅខាងក្រោមនេះ
http://www.krookroo.com/programming-languages/ms-visual-basic-6/85-it-vb6-4.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: