Page 1 of 1
TicTacToe help :/
Posted: Wed Mar 09, 2011 4:31 am
by lesan101
Im working on this tic tac toe program
if label 1 2 and 3 is X or O then i want msgbox to pop out.
i tried:
Code: Select allIf Label1.Text And Label2.Text = Label3.Text = True Then
MsgBox("X WINS")
End If
but that didn't work..
:?: :?:
Re: TicTacToe help :/
Posted: Wed Mar 09, 2011 5:29 am
by Skillful
Code: Select allIf Label1.Text And Label2.Text And Label3.Text = "X" Then
MsgBox("Player X Wins!!")
ElseIf Label1.Text And Label2.Text And Label3.Text = "O" Then
MsgBox("Player O Wins")
End If
+rep if helps please

Re: TicTacToe help :/
Posted: Wed Mar 09, 2011 12:54 pm
by mandai
The above code is trying to convert the text to boolean values, which will cause exceptions. You should do it this way:
Code: Select all If Label1.Text = "X" And Label2.Text = "X" And Label3.Text = "X" Then
MsgBox("X WINS")
End If
Re: TicTacToe help :/
Posted: Thu Mar 10, 2011 12:50 pm
by lesan101
Thank you both for your help, but i was able to find the problem.