For the program to compile the statements where you assign values to buttons need to be inside a function:
Sub SetButtons()
Button1.Text = gameArray(0, 0)
Button2.Text = gameArray(0, 1)
Button3.Text = gameArray(0, 2)
Button4.Text = gameArray(1, 0)
Button5.Text = gameArray(1, 1)
Button6.Text = gameArray(1, 2)
Button7.Text = gameArray(2, 0)
Button8.Text = gameArray(2, 1)
Button9.Text = gameArray(2, 2)
End Sub
As you need 2 views, a GUI and a text view, I'd recommend ending up with 3 projects:
- a TicTacToe library for the game logic (to be shared)
- a WinForms or WPF application for the GUI view (that references the library)
- a Console application for the text view (that references the library)
Here's an example of drawing a board in a console application:
Dim board(3, 3) As Char
' Set a O in the middle
board(1, 1) = "O"
' Set an X at the bottom right
board(2, 2) = "X"
' Show board
Console.WriteLine(board(0, 0) + "|" + board(1, 0) + "|" + board(2, 0))
Console.WriteLine("-----")
Console.WriteLine(board(0, 1) + "|" + board(1, 1) + "|" + board(2, 1))
Console.WriteLine("-----")
Console.WriteLine(board(0, 2) + "|" + board(1, 2) + "|" + board(2, 2))
which gives:
| |
-----
|O|
-----
| |X
For a little inspiration on the GUI side, here's a short Silverlight sample (written in F#): Tic-Tac-Toe