|
-
Feb 12th, 2008, 07:47 PM
#1
Thread Starter
New Member
[RESOLVED] Control Backround Images
HI, as a noob & as an assignment I have written a Noughts and crosses
program. It all works fine. I was trying to jazz it up by letting random noughts, crosses and empty squares fill the grid before the game starts.
This code works fine but only for a few timer clicks...and for some reason I always end up with a row of crosses across the middle !
the Cstr(tempPos) lines are just for debugging and they show the code and timer are still working...but the images dont change ??? HELP !
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
tempPos = Int(Rnd() * 9) + 3
If tempPos < 6 Then
Controls(tempPos).BackgroundImage = NoughtsAndCrosses.My.Resources.Resources.nought
lblInfo.BackColor = Color.Red
lblInfo.Text = " <<<<< PLAY NOW >>>>> "
lblInfo.Text = CStr(tempPos)
End If
If tempPos > 5 And tempPos < 9 Then
Controls(tempPos).BackgroundImage = NoughtsAndCrosses.My.Resources.Resources.cross
lblInfo.BackColor = Color.Blue
lblInfo.Text = " <<<<< PLAY NOW >>>>> "
lblInfo.Text = CStr(tempPos)
Else
Controls(tempPos).BackgroundImage = NoughtsAndCrosses.My.Resources.Resources.blank
lblInfo.BackColor = Color.Green
lblInfo.Text = " <<<<< PLAY NOW >>>>> "
lblInfo.Text = CStr(tempPos)
End If
End Sub
Many Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|