Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So, this is my situation. I have written this code where i have two pictureboxes in my form. Now, i created an animation using the two pictureboxes with a timer. The problem is that i want to write a if else statement which should be somewhat like this - when i click on the first picturebox, it says "try the other one" and the picturebox i clicked should disappear and the timer keeps going on and the same thing happens with the other picturebox too. Its only when i click on both the pictureboxes, thats when the timer stops. How can i write such a if-else statement for pictureboxes. Please help me.
Posted
Updated 2-Jun-14 0:39am
v2

How about this:


VB
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

   If Not PictureBox1.Visible AndAlso Not PictureBox2.Visible then
      Timer1.Stop
   End If

End Sub
 
Share this answer
 
v3
The way I read your question, you can't: you cannot "click on both pictureboxes" at the same time, as you only have the one mouse pointer, and thus the one "Click" position.

I think you need to rethink your design, and work out a way for the user to do things that are possible! :laugh:
 
Share this answer
 
Comments
Surajit Das 2-Jun-14 7:38am    
Actually i dint mean that i am going to click on both the picturebox at the same time. I meant that when you click on one of the picturebox, it disappears but the timer doesnt stop. The timer only stops when both the pictureboxes disappear.Is there a way to do it?

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