Public Class frmtictactoe Dim X As Boolean Dim o As Boolean Dim number As Integer Dim score11 As Integer Dim score12 As Integer Dim score13 As Integer Dim score21 As Integer Dim score22 As Integer Dim score23 As Integer Dim score31 As Integer Dim score32 As Integer Dim score33 As Integer
ok so im making a random tic tac toe project. im trying to make it switch from player x to player o or player o to player x. but everytime i try it it put all o instead. My teacher told me to put this if i wanted it to make it switch from player to player and if one player wins it will put the number of games that player won on the score board but it doesn't work. For the reset button i put everything to enable false but it doesnt work. My teacher told me it working but you might not no it because it a picture box. i dont know how to reset my picture to nake it false. If you can help me i would really appreciate it thank you.
Private Sub pic1_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic1.Click If X Then pic1.Image = picX.Image score11 = 10 Else pic1.Image = picO.Image score11 = 1 End If End Sub Private Sub pic2_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic2.Click If X Then pic2.Image = picX.Image score12 = 10 Else pic2.Image = picO.Image score12 = 1 End If End Sub Private Sub pic3_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic3.Click If X Then pic3.Image = picX.Image score13 = 10 Else pic3.Image = picO.Image score13 = 1 End If End Sub Private Sub pic4_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic4.Click If X Then pic4.Image = picX.Image score21 = 10 Else pic4.Image = picO.Image score21 = 1 End If End Sub Private Sub pic5_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic5.Click If X Then pic5.Image = picX.Image score22 = 10 Else pic5.Image = picO.Image score22 = 1 End If End Sub Private Sub pic6_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic6.Click If X Then pic6.Image = picX.Image score23 = 10 Else pic6.Image = picO.Image score23 = 1 End If End Sub Private Sub pic7_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic7.Click If X Then pic7.Image = picX.Image score31 = 10 Else pic7.Image = picO.Image score31 = 1 End If End Sub Private Sub pic8_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic8.Click If X Then pic8.Image = picX.Image score32 = 10 Else pic7.Image = picO.Image score32 = 1 End If End Sub Private Sub pic9_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles pic9.Click If X Then pic9.Image = picX.Image score33 = 10 Else pic9.Image = picO.Image score33 = 1 End If End Sub Private Sub butstart_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles butstart.Click pic1.Enabled = True pic2.Enabled = True pic3.Enabled = True pic4.Enabled = True pic5.Enabled = True pic6.Enabled = True pic7.Enabled = True pic8.Enabled = True pic9.Enabled = True End Sub Private Sub butrestart_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles butrestart.Click pic1.Enabled = False pic2.Enabled = False pic3.Enabled = False pic4.Enabled = False pic5.Enabled = False pic6.Enabled = False pic7.Enabled = False pic8.Enabled = False pic9.Enabled = False End Sub Private Sub frmtictactoe_Load(ByVal sender As System.Object, ByVale As System.EventArgs) Handles MyBase.Load pic1.Enabled = False pic2.Enabled = False pic3.Enabled = False pic4.Enabled = False pic5.Enabled = False pic6.Enabled = False pic7.Enabled = False pic8.Enabled = False pic9.Enabled = False End Sub End Class
This post has been edited by GunnerInc: 31 May 2012 - 04:08 PM
Reason for edit:: Added Code Tags

New Topic/Question
Reply



MultiQuote




|