Alright. Let's go through the list of corrections you should make. #1 Do you know about a structure array? Because YOU SERIOUSLY need one. A structure array is an array of structures, where a structure can be a anything from a textbox, button, labels, etc. So what you should do is make a 2-D structure array of buttons and assign each button with an array value. This will help you out in many ways. The second thing you need to do is put everything you have for one button into a function. That way you only have to have the code once. You will need to pass in the values for the button so something like this:
Function setTextValue(byref row as integer, byref col as integer){
buttonarray(row,col).enabled = false
Mapused(row,col) = true
if xturn = true then
buttonarray(row,col).text = "X"
else
buttonarray(row,col).text = "O"
end if
'basically whatever you want in the function.
}
This will help you. You could probably make this into a more object oriented design but I'm to lazy to help you with that. Now for the if statements:
If mat(0, 0) & mat(1, 0) = mat(2, 0) Then
MsgBox("You Win!")
Else
'Should be:
If (mat(0, 0) = mat(2,0)) and (mat(1, 0) = mat(2, 0)) Then
MsgBox("You Win!")
Else
I personally would take it from mat(0, 0) = mat(2,0) to be is mat(0,0) = "x" that way you are positive that it is correct, the reason for this is because there could be a chance mat(2,0) could be set to the wrong value.