I had a lot of posts to this question after I left work yesterday so
I'll make one blanket reply here. Thanks! To everyone. Seems there is
a way with ienumerator (thanks Cor). But that does sound too
complicated for me to get into. At least I was not overlooking
something obvious.
I couldn't find any way to get the current index while in the "For Each"
loop. I'd thought of Indexof too and it should return the index of the
item I'm on. (Although if you have several identical items in a
collection that'd throw a wrench into that. For me if I used the file
name which would be logical it should be fine as there wouldn't be
duplicate file names.) However indexof will not allow me to reposition
the for each loop to a new index.
I'd envisioned something like the windows media player's progress bar.
In my program jpgs are flipped by one by one and the progress bar shows
how far through the available jpgs it' gone. In WMP I can click on the
progress bar and have it instantly jump to that place in the
song/movie/whatever and it jumps--forward or back--to that point and
continues playing forward from there.
I understood from the beginning this could be done in a "For To" loop.
And, it's absolutely no problem to change the program to "For To" loop.
I just wanted to know if I was overlooking some functionality in "For
Each" loop.
So, I changed to "For To" and now am looking at determining what index
to reposition to based on a click on a progress bar--see the post I made
4 hours after this one. Gary has made an interesting suggestion I think
I'll play around with.
cj wrote:
When I running a loop: For Each File As System.io.FileInfo In FileInfo
Is there a way to tell which file number (index) I'm currently on?
Actually I'd like the ability to skip to a particular index--either
forward or back. It'd be nice to be able to set the index back or
forward with a command button perhaps and the loop just move to that
position and continue forward from there.
I'm specifically interested in doing this in the for each loop.