Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...