Visuala Basic
Dim bandera As Boolean
Dim a As String
Dim b As String
Dim contador As Integer
Dim contador2 As Integer
Dim contador3 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
If bandera = False Then
btn1.Text = ("0")
bandera = TrueElse
btn1.Text = ("x")
bandera = False
End If
btn1.Enabled = False
If btn1.Text = "0" And btn2.Text = "0" And btn3.Text = "0" Then
MsgBox("Gano " & b)
contador = contador + 1
Label4.Text = contador
ElseIf btn1.Text = "0" And btn4.Text = "0" And btn7.Text ="0" Then
MsgBox("Gano" & b)
contador = contador + 1
Label4.Text = contador
ElseIf btn1.Text = "0" And btn5.Text = "0" And btn9.Text = "0" Then
MsgBox("Gano " & b)
contador = contador + 1
Label4.Text = contador
ElseIf btn1.Text = "x" And btn2.Text = "x" And btn3.Text = "x" ThenMsgBox("Gano " & a)
contador2 = contador2 + 1
Label5.Text = contador2
contador2 = Label5.Text
ElseIf btn1.Text = "x" And btn4.Text = "x" And btn7.Text = "x" Then
MsgBox("Gano " & a)
contador2 = contador2 + 1
Label5.Text = contador2
contador2 = Label5.Text
ElseIf btn1.Text = "x" Andbtn5.Text = "x" And btn9.Text = "x" Then
MsgBox("Gano " & a)
contador2 = contador2 + 1
Label5.Text = contador
contador2 = Label5.Text
ElseIf btn1.Enabled = False And btn2.Enabled = False And btn3.Enabled = False And btn4.Enabled = False And btn5.Enabled = False And btn6.Enabled = False And btn7.Enabled = False And btn8.Enabled = FalseAnd btn9.Enabled = False Then
MsgBox("Empate")
contador3 = contador3 + 1
Label8.Text = contador3
contador3 = Label8.Text
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
b = InputBox("Cual es tu nombre")
a = InputBox("Cual es tunombre")
Label1.Text = (b)
Label3.Text = ("VS")
Label2.Text = (a)
Label4.Text = ""
Label5.Text = ""
Label8.Text = ""
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
If bandera = False Then
btn2.Text = ("0")
bandera = Trueelse
btn2.Text = ("x")
bandera = False
End If
btn2.Enabled = False
If btn2.Text = "0" And btn5.Text = "0" And btn8.Text = "0" Then
MsgBox("Gano" & b)
contador = contador + 1
Label4.Text = contador
contador = Label4.Text
ElseIf btn1.Text = "0" And btn2.Text ="0" And btn3.Text = "0" Then
MsgBox("Gano" & b)
contador = contador + 1
Label4.Text = contador
contador = Label4.Text
ElseIf btn2.Text = "x" And btn1.Text = "x" And btn3.Text = "x" Then
MsgBox("Gano" & a)
contador2 = contador2 + 1
Label5.Text = contador2
contador2 = Label5.TextElseIf btn2.Text = "x" And btn5.Text = "x" And btn8.Text = "x" Then
MsgBox("Gano" & a)
contador2 = contador2 + 1
Label5.Text = contador2
contador2 = Label5.Text
ElseIf btn1.Enabled = False And btn2.Enabled = False And btn3.Enabled = False And btn4.Enabled = False And btn5.Enabled = False And btn6.Enabled = False And...
Regístrate para leer el documento completo.