Tic Tac Toe, help me check my code.

benjaminpott

New member
Joined
Feb 1, 2010
Messages
2
Programming Experience
Beginner
So for the first time I attempted to create my own tic tac toe game. sometimes it doesn't work properly though. anyway I will attach it and also post my code here: (can someone help me?)

Code:
Public Class Form1

    Dim player1 As String

    Dim player2 As String

    Dim playercheck As Boolean = True

    Dim one As Boolean = True

    Dim two As Boolean = False

    Dim ano As Boolean = False

    Dim bno As Boolean = False

    Dim cno As Boolean = False

    Dim dno As Boolean = False

    Dim eno As Boolean = False

    Dim fno As Boolean = False

    Dim gno As Boolean = False

    Dim hno As Boolean = False

    Dim ino As Boolean = False

    Dim oneO As Boolean = False

    Dim oneX As Boolean = False

    Dim twoO As Boolean = False

    Dim twoX As Boolean = False

    Dim threeO As Boolean = False

    Dim threeX As Boolean = False

    Dim fourO As Boolean = False

    Dim fourX As Boolean = False

    Dim fiveO As Boolean = False

    Dim fiveX As Boolean = False

    Dim sixO As Boolean = False

    Dim sixX As Boolean = False

    Dim sevenO As Boolean = False

    Dim sevenX As Boolean = False

    Dim eightO As Boolean = False

    Dim eightX As Boolean = False

    Dim nineO As Boolean = False

    Dim nineX As Boolean = False

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

        Me.Size = New System.Drawing.Size(214, 237)

        player1 = pl1.Text
        player2 = pl2.Text

        Label1.Visible = False
        Label2.Visible = False

        pl1.Visible = False
        pl2.Visible = False

        Button10.Visible = False

        lbltop.Text = player1 & " (O's) vs " & player2 & " (X's)"

        playercheck = False

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If ano = True Then
            Else
                If one = True Then
                    Button1.Text = "O"
                    one = False
                    two = True
                    ano = True
                    oneO = True
                ElseIf two = True Then
                    Button1.Text = "X"
                    two = False
                    one = True
                    ano = True
                    oneX = True
                End If

            End If
        End If

        If oneO = True Then
            If twoO = True Then
                If threeO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If twoX = True Then
                If threeX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fourO = True Then
                If sevenO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fourX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fiveO = True Then
                If nineO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fiveX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If bno = True Then
            Else
                If one = True Then
                    Button2.Text = "O"
                    one = False
                    two = True
                    bno = True
                    twoO = True
                ElseIf two = True Then
                    Button2.Text = "X"
                    two = False
                    one = True
                    bno = True
                    twoX = True
                End If

            End If
        End If

        If oneO = True Then
            If twoO = True Then
                If threeO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If twoX = True Then
                If threeX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If twoO = True Then
            If fiveO = True Then
                If eightO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If twoX = True Then
            If fiveX = True Then
                If eightX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If


    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If cno = True Then
            Else
                If one = True Then
                    Button3.Text = "O"
                    one = False
                    two = True
                    cno = True
                    threeO = True
                ElseIf two = True Then
                    Button3.Text = "X"
                    two = False
                    one = True
                    cno = True
                    threeX = True
                End If

            End If
        End If

        If oneO = True Then
            If twoO = True Then
                If threeO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If twoX = True Then
                If threeX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If sixO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If sixX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If fiveO = True Then
                If sevenO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If fiveX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If dno = True Then
            Else
                If one = True Then
                    Button4.Text = "O"
                    one = False
                    two = True
                    dno = True
                    fourO = True
                ElseIf two = True Then
                    Button4.Text = "X"
                    two = False
                    one = True
                    dno = True
                    fourX = True
                End If

            End If
        End If

        If fourO = True Then
            If fiveO = True Then
                If sixO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If fourX = True Then
            If fiveX = True Then
                If sixX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fourO = True Then
                If sevenO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fourX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If


    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If eno = True Then
            Else
                If one = True Then
                    Button5.Text = "O"
                    one = False
                    two = True
                    eno = True
                    fiveO = True
                ElseIf two = True Then
                    Button5.Text = "X"
                    two = False
                    one = True
                    eno = True
                    fiveX = True
                End If

            End If
        End If

        If fourO = True Then
            If fiveO = True Then
                If sixO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If fourX = True Then
            If fiveX = True Then
                If sixX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If twoO = True Then
            If fiveO = True Then
                If eightO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If twoX = True Then
            If fiveX = True Then
                If eightX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fiveO = True Then
                If nineO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fiveX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If fiveO = True Then
                If sevenO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If fiveX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If fno = True Then
            Else
                If one = True Then
                    Button6.Text = "O"
                    one = False
                    two = True
                    fno = True
                    sixO = True
                ElseIf two = True Then
                    Button6.Text = "X"
                    two = False
                    one = True
                    fno = True
                    sixX = True
                End If

            End If
        End If

        If fourO = True Then
            If fiveO = True Then
                If sixO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If fourX = True Then
            If fiveX = True Then
                If sixX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If sixO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If sixX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If gno = True Then
            Else
                If one = True Then
                    Button7.Text = "O"
                    one = False
                    two = True
                    gno = True
                    sevenO = True
                ElseIf two = True Then
                    Button7.Text = "X"
                    two = False
                    one = True
                    gno = True
                    sevenX = True
                End If

            End If
        End If

        If sevenO = True Then
            If eightO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If sevenX = True Then
            If eightX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fourO = True Then
                If sevenO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fourX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.Maroon
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If fiveO = True Then
                If sevenO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If fiveX = True Then
                If sevenX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button8.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If


    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If hno = True Then
            Else
                If one = True Then
                    Button8.Text = "O"
                    one = False
                    two = True
                    hno = True
                    eightO = True
                ElseIf two = True Then
                    Button8.Text = "X"
                    two = False
                    one = True
                    hno = True
                    eightX = True
                End If

            End If
        End If

        If sevenO = True Then
            If eightO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If sevenX = True Then
            If eightX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If twoO = True Then
            If fiveO = True Then
                If eightO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If twoX = True Then
            If fiveX = True Then
                If eightX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.Maroon
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.LightGray
                    again.Visible = True
                    Button1.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button9.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

        If playercheck = True Then
            lbltop.Text = "Please Enter Player Names. NOW!!!"
        Else
            If ino = True Then
            Else
                If one = True Then
                    Button9.Text = "O"
                    one = False
                    two = True
                    ino = True
                    nineO = True
                ElseIf two = True Then
                    Button9.Text = "X"
                    two = False
                    one = True
                    ino = True
                    nineX = True
                End If

            End If
        End If

        If sevenO = True Then
            If eightO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If sevenX = True Then
            If eightX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.Maroon
                    Button8.ForeColor = Color.Maroon
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button6.Enabled = False
                End If
            End If
        End If

        If threeO = True Then
            If sixO = True Then
                If nineO = True Then
                    lbltop.Text = player1 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If threeX = True Then
            If sixX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.LightGray
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.Maroon
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.LightGray
                    Button6.ForeColor = Color.Maroon
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button1.Enabled = False
                    Button2.Enabled = False
                    Button4.Enabled = False
                    Button5.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneO = True Then
            If fiveO = True Then
                If nineO = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX = True Then
            If fiveX = True Then
                If nineX = True Then
                    lbltop.Text = player2 & " wins!"
                    Button1.ForeColor = Color.Maroon
                    Button2.ForeColor = Color.LightGray
                    Button3.ForeColor = Color.LightGray
                    Button4.ForeColor = Color.LightGray
                    Button5.ForeColor = Color.Maroon
                    Button6.ForeColor = Color.LightGray
                    Button7.ForeColor = Color.LightGray
                    Button8.ForeColor = Color.LightGray
                    Button9.ForeColor = Color.Maroon
                    again.Visible = True
                    Button2.Enabled = False
                    Button3.Enabled = False
                    Button4.Enabled = False
                    Button6.Enabled = False
                    Button7.Enabled = False
                    Button8.Enabled = False
                End If
            End If
        End If

        If oneX Or oneO = True Then
            If twoO Or twoX = True Then
                If threeO Or threeX = True Then
                    If fourO Or fourX = True Then
                        If fiveO Or fiveX = True Then
                            If sixO Or sixX = True Then
                                If sevenO Or sevenX = True Then
                                    If eightO Or eightX = True Then
                                        If nineO Or nineX = True Then

                                            Button1.Enabled = False
                                            Button2.Enabled = False
                                            Button3.Enabled = False
                                            Button4.Enabled = False
                                            Button5.Enabled = False
                                            Button6.Enabled = False
                                            Button7.Enabled = False
                                            Button8.Enabled = False
                                            Button9.Enabled = False

                                            again.Visible = True

                                            lbltop.Text = "WOW, you guys tied..."

                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If

    End Sub

    Private Sub again_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles again.Click

        Button11.Visible = True
        Button12.Visible = True
        Button1.Visible = False
        Button2.Visible = False
        Button3.Visible = False
        Button4.Visible = False
        Button5.Visible = False
        Button6.Visible = False
        Button7.Visible = False
        Button8.Visible = False
        Button9.Visible = False
        again.Visible = False

        lbltop.Text = "please select:"

    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

        playercheck = False
        one = True
        two = False
        ano = False
        bno = False
        cno = False
        dno = False
        eno = False
        fno = False
        gno = False
        hno = False
        ino = False
        oneO = False
        oneX = False
        twoO = False
        twoX = False
        threeO = False
        threeX = False
        fourO = False
        fourX = False
        fiveO = False
        threeO = False
        sixX = False
        sixX = False
        sevenO = False
        sevenX = False
        eightO = False
        eightX = False
        nineO = False
        nineX = False

        Button11.Visible = False
        Button12.Visible = True
        Button1.Visible = True
        Button2.Visible = True
        Button3.Visible = True
        Button4.Visible = True
        Button5.Visible = True
        Button6.Visible = True
        Button7.Visible = True
        Button8.Visible = True
        Button9.Visible = True
        Button12.Visible = False

        lbltop.Text = player1 & " (O's) vs " & player2 & " (X's)"

        Button9.Enabled = True
        Button8.Enabled = True
        Button7.Enabled = True
        Button6.Enabled = True
        Button5.Enabled = True
        Button4.Enabled = True
        Button3.Enabled = True
        Button2.Enabled = True
        Button1.Enabled = True

        Button1.ForeColor = Color.Black
        Button2.ForeColor = Color.Black
        Button3.ForeColor = Color.Black
        Button4.ForeColor = Color.Black
        Button5.ForeColor = Color.Black
        Button6.ForeColor = Color.Black
        Button7.ForeColor = Color.Black
        Button8.ForeColor = Color.Black
        Button9.ForeColor = Color.Black

        Button1.Text = "-"
        Button2.Text = "-"
        Button3.Text = "-"
        Button4.Text = "-"
        Button5.Text = "-"
        Button6.Text = "-"
        Button7.Text = "-"
        Button8.Text = "-"
        Button9.Text = "-"

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        playercheck = True
        one = True
        two = False
        ano = False
        bno = False
        cno = False
        dno = False
        eno = False
        fno = False
        gno = False
        hno = False
        ino = False
        oneO = False
        oneX = False
        twoO = False
        twoX = False
        threeO = False
        threeX = False
        fourO = False
        fourX = False
        fiveO = False
        threeO = False
        sixX = False
        sixX = False
        sevenO = False
        sevenX = False
        eightO = False
        eightX = False
        nineO = False
        nineX = False

        Button11.Visible = False
        Button12.Visible = True
        Button1.Visible = True
        Button2.Visible = True
        Button3.Visible = True
        Button4.Visible = True
        Button5.Visible = True
        Button6.Visible = True
        Button7.Visible = True
        Button8.Visible = True
        Button9.Visible = True
        Button12.Visible = False

        lbltop.Text = "Please Enter Player Names"

        Button9.Enabled = True
        Button8.Enabled = True
        Button7.Enabled = True
        Button6.Enabled = True
        Button5.Enabled = True
        Button4.Enabled = True
        Button3.Enabled = True
        Button2.Enabled = True
        Button1.Enabled = True

        Button1.ForeColor = Color.Black
        Button2.ForeColor = Color.Black
        Button3.ForeColor = Color.Black
        Button4.ForeColor = Color.Black
        Button5.ForeColor = Color.Black
        Button6.ForeColor = Color.Black
        Button7.ForeColor = Color.Black
        Button8.ForeColor = Color.Black
        Button9.ForeColor = Color.Black

        Button1.Text = "-"
        Button2.Text = "-"
        Button3.Text = "-"
        Button4.Text = "-"
        Button5.Text = "-"
        Button6.Text = "-"
        Button7.Text = "-"
        Button8.Text = "-"
        Button9.Text = "-"

        Me.Size = New System.Drawing.Size(214, 345)

        Label1.Visible = True
        Label2.Visible = True
        pl1.Visible = True
        pl2.Visible = True

        Button10.Visible = True

    End Sub
End Class
 

Attachments

Last edited by a moderator:
Top Bottom