VB Code:
Public Function compturn() ' Dim compmove As Integer Dim mask As Object mask = Format(compmove, "btn#") compmove = CStr(Int(Rnd() * 10)) Label4.Text = mask mask.Text = "O" mask.Enabled = False 'Make sure that a button that is already clicked 'by either the user or the computer is not clicked again If mask.Enabled = False And compmove = 1 Then compmove += 1 If compmove = 10 Then compmove = 1 End If End If
So I have my form settup with 9 buttons named btn1, btn2...etc
I'm trying to make it so that if you click a button it will go X, then the computer will randomly select a spot, the problem lies in this line "mask.Text = "O" " or at least that is where the error is given, any help or suggestions would be greatly appreciated, I can try to explain more of what i'm trying to do but I need specific questions otherwise i dont know what to tell you.. thanks in advance




Reply With Quote