|
-
Sep 23rd, 2010, 12:01 PM
#1
Thread Starter
Hyperactive Member
Looping and Input...
Hello,
I have a little situation and i am not sure of the best way to do it.
- My program lets the user select a folder
- From that folder i need to select all .png files
- One by one i need to load them into a picture box, await a button press and then go to the next image.
The above that i have typed in red is where im not sure what to do. The other steps i can do.
Any pointers or help would be great,
thanks.
If a post has been usefull then Rate it! 
-
Sep 23rd, 2010, 12:21 PM
#2
Fanatic Member
Re: Looping and Input...
What about creating a string array with all the file locations stored within it, then increase the index being shown in the picturebox by 1 each time the button is clicked?
-
Sep 23rd, 2010, 02:29 PM
#3
Re: Looping and Input...
I like that solution, but would offer one alternative based on ignorance: Load all the files into a queue of images rather than a string array of files. The string array would almost certainly be easier, but if there was any signficiant time required to load an image, then loading all the images would have a bit of an advantage in that it could be performed as a background process, so that images are being found and added to the queue even as the UI is waiting for the user to press that button.
In any case, a Queue object might be superior to an array. There wouldn't be an index, you would just be stripping the next item off the queue to load into the picturebox.
My usual boring signature: Nothing
 
-
Sep 23rd, 2010, 09:46 PM
#4
Fanatic Member
Re: Looping and Input...
 Originally Posted by Shaggy Hiker
I like that solution, but would offer one alternative based on ignorance: Load all the files into a queue of images rather than a string array of files. The string array would almost certainly be easier, but if there was any signficiant time required to load an image, then loading all the images would have a bit of an advantage in that it could be performed as a background process, so that images are being found and added to the queue even as the UI is waiting for the user to press that button.
In any case, a Queue object might be superior to an array. There wouldn't be an index, you would just be stripping the next item off the queue to load into the picturebox.
Yes from your explanation that does sound better than my method, if people are loading 1900x1600 images with max quality it might take a while for the picture box to load, I'd never heard of a queue before so I might have to do some reading!
-
Sep 23rd, 2010, 10:29 PM
#5
Re: Looping and Input...
You HAVE heard of a List (of T), which is probably the most common of the generic objects, but there are also the Queue(of T), Stack(of T), and Cup (of T), though that last one isn't found in the Generic namespace, but rather in the British namespace. There is also the Dictionary, and a few others that I have forgotten about. They all have their uses, but the List is the most commonly used.
My usual boring signature: Nothing
 
-
Sep 23rd, 2010, 10:42 PM
#6
Re: Looping and Input...
 Originally Posted by Shaggy Hiker
You HAVE heard of a List (of T), which is probably the most common of the generic objects, but there are also the Queue(of T), Stack(of T), and Cup (of T), though that last one isn't found in the Generic namespace, but rather in the British namespace. There is also the Dictionary, and a few others that I have forgotten about. They all have their uses, but the List is the most commonly used.
I just boosted your reputation for the original solution but now I want to take it back for that Cup(Of T) line.
-
Sep 23rd, 2010, 11:23 PM
#7
Fanatic Member
Re: Looping and Input...
 Originally Posted by Shaggy Hiker
You HAVE heard of a List (of T), which is probably the most common of the generic objects, but there are also the Queue(of T), Stack(of T), and Cup (of T), though that last one isn't found in the Generic namespace, but rather in the British namespace. There is also the Dictionary, and a few others that I have forgotten about. They all have their uses, but the List is the most commonly used.
Yeah I've used List(Of T) before and I've had Cup(Of T) before, but I've never had the occassion to use Queue(Of T), so thank you!
-
Sep 24th, 2010, 12:29 PM
#8
Re: Looping and Input...
I regret to say that I spent a few hours last night contemplating how to turn that particular pun into a functional class. Eventually it occured to me that I might change it to Spot (of T), since we do lots of GIS work. Perhaps I could use that class to handle lat/long information in different formats. However, forcing such a solution into a generic design just for the sake of a pun just doesn't seem worthwhile.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|