VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

Join 307,218 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,631 people online right now. Registration is fast and FREE... Join Now!




Tic Tac Toe with Text Boxes

 

Tic Tac Toe with Text Boxes

piefork

1 Dec, 2008 - 09:52 PM
Post #1

New D.I.C Head
*

Joined: 1 Dec, 2008
Posts: 4


My Contributions
Hey, I am fairly new to Visual Basic and for an assignment I have to program a two player tic tac toe using text boxes as the squares.

The problem I am having is that it won't declare on the if statement who won, even though the variables are working correctly.

CODE
Private Sub cmdcheck_Click()
Dim victory1, victory2, victory3, victory4, victory5, victory6, victory7, victory8 As String

victory1 = txttopleft.Text & txttopright.Text & txttopmiddle.Text
victory2 = txttopleft.Text & txtmiddle.Text & txtbottomright.Text
victory3 = txttopright.Text & txtmiddle.Text & txtbottomleft.Text
victory4 = txttopleft.Text & txtmiddleleft.Text & txtbottomleft.Text
victory5 = txttopmiddle.Text & txtmiddle.Text & txtbottommid.Text
victory6 = txttopright.Text & txtmiddleright.Text & txtbottomright.Text
victory7 = txtmiddleleft.Text & txtmiddle.Text & txtmiddleright.Text
victory8 = txtbottomleft.Text & txtbottommid.Text & txtbottomright.Text

If (victory1 = xxx) Or (victory2 = xxx) Or (victory3 = xxx) Or (victory4 = xxx) Or (victory5 = xxx) Or (victory6 = xxx) Or (victory7 = xxx) Or (victory8 = xxx) Then
Picture1.Print "X WINS!"
ElseIf (victory1 = ooo) Or (victory2 = ooo) Or (victory3 = ooo) Or (victory4 = ooo) Or (victory5 = ooo) Or (victory6 = ooo) Or (victory7 = ooo) Or (victory8 = ooo) Then
Picture1.Print "O WINS!"
End If
End Sub


any suggestions would be greatly appreciated, thank you.

User is offlineProfile CardPM
+Quote Post


Posts in this topic

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 10:16PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month