J
Jerry West
I have a routine that updates a PictureBox image every x seconds. I do this
by first loading an array with the path to all of the images. I then
generate a random number to use as the index of the array. A timer is set to
update the PictureBox. This works great the first time through but fails on
all subsequent Timer events. If I simply step through the code it works
fine. If I run it only the first time through does the PictureBox update the
picture. Can someone tell me what I'm doing wrong in getting all subsequent
calls to update the PictureBox to work? My code is:
Within the Timer Tick event....
Dim Photo As Integer
Photo = RandomNumber(ss.Pics.Count)
Dim myImage As Bitmap = New Bitmap(ss.Pics(Photo).FullName, True)
Me.pic1.Image = myImage
As I said, fine the first time through and then each subsequent Tick event
fails to update the PictureBox w/new pic. I have verified that each time
through the path statement is correct. What the heck? It seems simple
enough. What am I doing wrong? I've tried placing a pic1.Dispose call before
and after updating the PictureBox to no avail.
Any insight appreciated!!
JW
by first loading an array with the path to all of the images. I then
generate a random number to use as the index of the array. A timer is set to
update the PictureBox. This works great the first time through but fails on
all subsequent Timer events. If I simply step through the code it works
fine. If I run it only the first time through does the PictureBox update the
picture. Can someone tell me what I'm doing wrong in getting all subsequent
calls to update the PictureBox to work? My code is:
Within the Timer Tick event....
Dim Photo As Integer
Photo = RandomNumber(ss.Pics.Count)
Dim myImage As Bitmap = New Bitmap(ss.Pics(Photo).FullName, True)
Me.pic1.Image = myImage
As I said, fine the first time through and then each subsequent Tick event
fails to update the PictureBox w/new pic. I have verified that each time
through the path statement is correct. What the heck? It seems simple
enough. What am I doing wrong? I've tried placing a pic1.Dispose call before
and after updating the PictureBox to no avail.
Any insight appreciated!!
JW