You are on page 1of 2

TALLER DE VISUAL BASIC

JUEGO DEL AHORCADO

Command1 Command3

form1
Text1

Line10(0)

Line2
Frame1
Line3

Shape2

0 1
Command2
Line9
Line8 Line7 Es una matriz
Line1 Line4

Line6
Line5

Shape1

Dim j As Byte partes = 1


Dim n As Integer letrasm
Dim espacio As Integer borrar
Dim partes As Byte End Sub
Dim error As Byte Private Sub Command2_Click(Index As
Dim gano As Byte Integer)
Private Sub Command1_Click() For j = 0 To n - 1
For j = 1 To n - 1 If Command2(Index).Caption =
Unload Label1(j) Label1(j).Caption Then
Unload Line10(j) Label1(j).Visible = True
Label1(0).Visible = False error = 1
Line10(0).Visible = False gano = gano + 1
Next j Command2(Index).Enabled = False
espacio = 0 End If
Text1.Text = "" Next j
Text1.Enabled = True If gano = n Then
Text1.Visible = True MsgBox "GANASTE"
Text1.SetFocus Command1_Click
Command1.Enabled = False 'partes = 1
gano = 0 End If
If error = 0 Then End Sub
muneco Sub muneco()
End If Select Case partes
error = 0 Case 1
End Sub Shape2.Visible = True
Private Sub Form_Load() Case 2
Label1(0).Visible = False Line4.Visible = True
Line10(0).Visible = False Case 3
Command1.Enabled = False Line5.Visible = True
partes = 1 Case 4
letrasm Line6.Visible = True
End Sub Case 5
Private Sub Text1_KeyPress(KeyAscii As Line7.Visible = True
Integer) Case 6
If KeyAscii = 13 Then Line8.Visible = True
If Text1.Text = "" Then Exit Sub Case 7
Text1.Enabled = False Line9.Visible = True
Label1(0).Visible = True MsgBox "PERDISTE"
Line10(0).Visible = True Command1_Click
n = Len(Text1.Text) End Select
For j = 1 To n - 1 partes = partes + 1
espacio = espacio + 700 End Sub
Load Label1(j) Sub borrar()
Load Line10(j) Shape2.Visible = False
Label1(j).Visible = True Line4.Visible = False
Line10(j).Visible = True Line5.Visible = False
Label1(j).Left = Label1(j).Left + espacio Line6.Visible = False
Line10(j).X1 = Line10(j).X1 + espacio Line7.Visible = False
Line10(j).X2 = Line10(j).X2 + espacio Line8.Visible = False
Next j Line9.Visible = False
For j = 1 To n End Sub
Label1(j - 1).Visible = False Sub letrasm()
Label1(j - 1).Caption = Mid(Text1.Text, For j = 0 To 26
j, 1) Command2(j).Enabled = False
Next j Next j
Label2.Caption = "La palabra secreta End Sub
posee " & n & " letras" Sub letras()
Text1.Visible = False For j = 0 To 26
Command1.Enabled = True Command2(j).Enabled = True
letras Next j
End If End Sub

You might also like