load images in list without stopping execution
-
i have a form with a list that shows thumbnails of many jpg pictures. i works with a loop, that looks through the paths of the jpgs from a database, and adds the image to a image list, then adds the item into the list with the corresponding image. works fine. the problem is, that loading the images delays the program execution, and so I've made it into a "please wait" dialog, but still its quite slow. how can i create a method that loads the list without the images, and then, without pausing execution, (i.e. in the background) loads the images (into the image list) one by one. I've tried a few ways, some work but it's very inefficient :( thank you in advance
Ericos Georgiades
-
i have a form with a list that shows thumbnails of many jpg pictures. i works with a loop, that looks through the paths of the jpgs from a database, and adds the image to a image list, then adds the item into the list with the corresponding image. works fine. the problem is, that loading the images delays the program execution, and so I've made it into a "please wait" dialog, but still its quite slow. how can i create a method that loads the list without the images, and then, without pausing execution, (i.e. in the background) loads the images (into the image list) one by one. I've tried a few ways, some work but it's very inefficient :( thank you in advance
Ericos Georgiades
You'll have to move your image loading code to a background thread. There's many examples of using the BackgroundWorker component. All you have to do is Google for it.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
i have a form with a list that shows thumbnails of many jpg pictures. i works with a loop, that looks through the paths of the jpgs from a database, and adds the image to a image list, then adds the item into the list with the corresponding image. works fine. the problem is, that loading the images delays the program execution, and so I've made it into a "please wait" dialog, but still its quite slow. how can i create a method that loads the list without the images, and then, without pausing execution, (i.e. in the background) loads the images (into the image list) one by one. I've tried a few ways, some work but it's very inefficient :( thank you in advance
Ericos Georgiades
-
You'll have to move your image loading code to a background thread. There's many examples of using the BackgroundWorker component. All you have to do is Google for it.
Dave Kreskowiak Microsoft MVP - Visual Basic
i've already tried a background worker, yet i guess i need to time it better or work on the code cause it loads them and if you touch one unloaded it ruins certain things (guess i'd just disable them at first) thank you, guess i was waiting for a diffrent approach but this is probably the best way
Ericos Georgiades
-
- use a databound listbox and get the records from the database and set the datasource to the result 2) look into "threading" to load behind the scenes.
if i set the datasource on the listbox (haven't tried it) then how do i get to load jpgs into it? i didn't think i could, i'll give it a try (with a databound imagelist aswell?) thanks
Ericos Georgiades
-
if i set the datasource on the listbox (haven't tried it) then how do i get to load jpgs into it? i didn't think i could, i'll give it a try (with a databound imagelist aswell?) thanks
Ericos Georgiades