Option Explicit
Function cambio()
If Label11.Caption = "1" Then
Label11.Caption = "2"
Command2.Caption = "O"
Command3.Caption = "O"
Command4.Caption = "O"
Command5.Caption = "O"
Command6.Caption = "O"
Command7.Caption = "O"
Command8.Caption = "O"
Command9.Caption = "O"
Command10.Caption = "O"
Else: Label11.Caption = "1"
Command2.Caption = "X"
Command3.Caption = "X"
Command4.Caption = "X"
Command5.Caption = "X"
Command6.Caption = "X"
Command7.Caption = "X"
Command8.Caption = "X"
Command9.Caption = "X"
Command10.Caption = "X"
End If
End Function
Function ganador()
If Label1.Caption & Label2.Caption & Label3.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label4.Caption & Label5.Caption & Label6.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label7.Caption & Label8.Caption & Label9.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label1.Caption & Label4.Caption & Label7.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label2.Caption & Label5.Caption & Label8.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label3.Caption & Label6.Caption & Label9.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label1.Caption & Label5.Caption & Label9.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label3.Caption & Label5.Caption & Label7.Caption = "XXX" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:1"
MsgBox "EL GANADOR ES EL JUGADOR 1!!!", vbExclamation, Me.Caption
End If
If Label1.Caption & Label2.Caption & Label3.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label4.Caption & Label5.Caption & Label6.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label7.Caption & Label8.Caption & Label9.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label1.Caption & Label4.Caption & Label7.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label2.Caption & Label5.Caption & Label8.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label3.Caption & Label6.Caption & Label9.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label1.Caption & Label5.Caption & Label9.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
If Label3.Caption & Label5.Caption & Label7.Caption = "OOO" Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
Label12.Caption = "Jugador:2"
MsgBox "EL GANADOR ES EL JUGADOR 2!!!", vbExclamation, Me.Caption
End If
End Function
Private Sub Command1_Click()
Label11.Caption = "1"
Label1.Caption = ""
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label8.Caption = ""
Label9.Caption = ""
Label12.Caption = "Jugador:"
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
End Sub
Private Sub Command2_Click()
If Label1.Caption = "" Then
Label1.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command3_Click()
If Label4.Caption = "" Then
Label4.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command4_Click()
If Label7.Caption = "" Then
Label7.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command5_Click()
If Label2.Caption = "" Then
Label2.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command6_Click()
If Label5.Caption = "" Then
Label5.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command7_Click()
If Label8.Caption = "" Then
Label8.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command8_Click()
If Label3.Caption = "" Then
Label3.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub
Private Sub Command9_Click()
If Label6.Caption = "" Then
Label6.Caption = Command2.Caption
Call cambio
Call ganador
Else: MsgBox "ya se ha marcado esta casilla", vbInformation, Me.Caption
End If
End Sub