Slurpee Posted June 30, 2003 Posted June 30, 2003 Hey quick question...I've 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 I've written causes the app to crash every 20~30sec...guess I'm doing something wrong. Anyone have any ideas? My code is below 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 Quote
Slurpee Posted July 1, 2003 Author Posted July 1, 2003 i've 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. 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.