Click here to Skip to main content
15,069,297 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello :

I have been writing a program, a simple memory match program for my granddaughter.

The code is too large to place here but I have a small problem someone might be able to help with if you have a second.

If gamestart = 1 Then Button1.Visible = False : Button1.SendToBack() : PictureBox22.Visible = True : PictureBox22.BringToFront() : Pickcount = Pickcount + 1 : Call Picksound()

In the line above I check if the game has started with a gamestart = 0 or 1
If the game has started and when this button (1) is pushed the button is sent to the back and set to not visible. Then I bring the game tile or Picturebox forward and make it visible. THIS WORKS FINE!

Then I run this line...

If gamestart = 1 Then Button2.Visible = False : Button2.SendToBack() : PictureBox23.Visible = True : PictureBox23.BringToFront() : Pickcount = Pickcount + 1 : Call Picksound()

In this line the second button is pushed same thing happens.. It also works...

HOWEVER, when I check it to see if the pictures match and add a delay it all falls apart. I use this simple delay

For time = 1 To 550000000 : Next time

When I add the delay, and then reset the buttons when they do no match the second picturebox is never displayed.

If I take out the delay, and never reset the buttons both buttons display just fine. I have put from break points in the code and it seems even take out the
check if the match code. Once the delay is added the second image is never displayed. Without the delay you never get a chance to see the image before it resets to the button image. Any suggestions would be great!!!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900