image rotator problems

Slurpee

Member
Joined
Apr 19, 2003
Messages
15
Hey quick question...Ive written a little program that grabs local radar images from a web server. The images are updated ever 10 minutes so I want to display the four images I DL until I DL the next four images :) my problem is that the code Ive written causes the app to crash every 20~30sec...guess Im doing something wrong. Anyone have any ideas? My code is below

Code:
Private Sub LoadImages(ByVal status As Boolean)
        
Dim intX As Integer
Dim myImage As ArrayList = New ArrayList()
Dim tThread As System.Threading.Thread


  For intX = 0 To 3
myImage.Add(Image.FromFile(".\images\" & intX & ".gif"))           Next intX
       
Do While status = True
For intX = 0 To 3
       PictureBox1.Location = New System.Drawing.Point(-5, -20)
       Me.PictureBox1.Image = CType(myImage(intX), bitmap)                    
      PictureBox1.Size = PictureBox1.Image.Size
      System.Threading.Thread.Sleep(1000)
   PictureBox1.Refresh()
   Next intX
Loop

    End Sub
 
ive come up with a simple answer to my own question :)

anyway instead of the loop I have implementer a timer and it works a treat.

Code:
 Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
         increment counter
        Count = (Count + 1) Mod 3
         load next image
        PictureBox1.Image = CType(myImage(Count), Image)
    End Sub
 
Back
Top