Array problem please help

Ezguy

Freshman
Joined
Jul 24, 2003
Messages
41
HI all,

I have a array called filepath

dim filepath(10000) as string

The values in the filepath array is added automatically.

filepath(1) = "c:\a.jpg"
filepath(2) = "c:\a.jpg"
filepath(3) = "c:\a.jpg"
filepath(4) = "c:\a.jpg"
filepath(5) = "c:\a.jpg"

Iam using the timer control to display picture in a picture box.

like this

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

P2.Image = System.Drawing.Image.FromFile(filepath(j))
j = j+1
End Sub

this is my problem

if I make filepath(2) = "false"


I don't want the timer to loop through this array index instead it should go to the next index where there is a actual path


hope you understand

thanks

Ezguy
 
Try something like this:
Visual Basic:
j += 1

Do Until Not filepath(j) Is Nothing And filepath(j).Length > 0
  j += 1
  If j > filePath.GetUpperBound(0) Then Return
Loop

P2.Image = Image.FromFile(filepath(j))
 
Back
Top