6435232 0 Newbie Poster

I'm making a game for class, and I don't know how to go about it for this part of the game... How do I make the program detect the command buttons around it?

The game is a 8x8 board that looks like this:

http://s27.postimg.o...shovn/image.png

When it is a player's turn (player x) and they put an x right beside one of the O's, then it changes to X.

http://s28.postimg.o...inhsd/image.png

My code is here.

Option Explicit
Private Const playerx As String = "X"
Private Const playero As String = "O"
Private nextplayer As String

Private Sub cmd1_Click(Index As Integer)
    Dim intIndex As Integer
    Dim intIndex2 As Integer

    'Take turns
    If nextplayer = "X" Then
        cmd1(Index).Caption = nextplayer
        nextplayer = playero
        lblAnswer.Caption = "Player O turn"
    ElseIf nextplayer = "O" Then
        cmd1(Index).Caption = nextplayer
        nextplayer = playerx
        lblAnswer.Caption = "Player X turn"
    End If

    'Check for other x/o beside or above placed x/o
    If cmd1(Index) = nextplayer Then
        If cmd1(Index + 1) <> nextplayer Then
            If cmd1(Index - 9) <> nextplayer Then
                cmd1(Index + 1).Caption = nextplayer
                cmd1(Index - 9).Caption = nextplayer
            End If
        End If
    End If

    'Disable buttons with stuff in them
    For intIndex = 0 To 63
        If cmd1(intIndex).Caption <> "" Then
            cmd1(intIndex).Enabled = False
        Else
            cmd1(intIndex).Enabled = True
        End If
    Next

End Sub

Private Sub cmdNewGame_Click()
    Call Form_Load
End Sub

Private Sub Form_Load()
    Dim intIndex As Integer

    'Make board blank
    For intIndex = 0 To 63
        cmd1(intIndex).Caption = ""
    Next

    'Make board have x and o
    cmd1(7).Caption = "O"
    cmd1(6).Caption = "O"
    cmd1(15).Caption = "O"
    cmd1(14).Caption = "O"

    cmd1(56).Caption = "X"
    cmd1(57).Caption = "X"
    cmd1(49).Caption = "X"
    cmd1(48).Caption = "X"

    'Disable buttons with stuff in them
    For intIndex = 0 To 63
        If cmd1(intIndex).Caption <> "" Then
            cmd1(intIndex).Enabled = False
        Else
            cmd1(intIndex).Enabled = True
        End If
    Next

    If nextplayer = "" Then
        nextplayer = playerx
        lblAnswer.Caption = "Player X turn"
    End If
End Sub