Vb.Net Image List

5 pts.
Tags:
Arrays (programming)
VB.NET
I am Trying to build a game that uses arrays to select an image from an image list. when i run the game, i get an image in the image box, but it keeps cycling through all three options. the code so far is: Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim flagRight As Integer = 0 Dim flagLeft As Integer = 0 Dim I, J As Integer Do Until flagRight = 1 I = Int(Rnd() * 3) picRight.Image = imlRight.Images(I) flagRight = 1 Loop Do Until flagLeft = 1 J = Int(Rnd() * 3) picLeft.Image = imlLeft.Images(J) picRight.Visible = True flagLeft = 1 Loop Can anyone help thanks a lot

Answer Wiki

Thanks. We'll let you know when a new response is added.

The value of FlagRight and FlagLeft is being reset on each Timer Tick with

Dim flagRight As Integer = 0

inside the event handler., which is why your attempt to set its value to 1 as a means of stopping it fails.

I am not exactly sure what it is that you want to do though.

If you want to post up more of an explanation of the steps you want to happen it would be easier to show you the appropriate code.

(Just something along the lines of “User clicks button – Timer is enabled, Random images are shown, when user does <whatever> images change … etc)

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following