TicTacToe help :/

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
lesan101
Top Poster
Top Poster
Posts: 193
Joined: Tue Jun 29, 2010 8:10 am

TicTacToe help :/
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 all
If Label1.Text And Label2.Text = Label3.Text = True Then
            MsgBox("X WINS")
        End If
but that didn't work..
:?: :?:
Image
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: TicTacToe help :/
Skillful
Code: Select all
If 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 :)
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: TicTacToe help :/
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
User avatar
lesan101
Top Poster
Top Poster
Posts: 193
Joined: Tue Jun 29, 2010 8:10 am

Re: TicTacToe help :/
lesan101
Thank you both for your help, but i was able to find the problem.
Image
4 posts Page 1 of 1
Return to “Tutorial Requests”