Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. load images in list without stopping execution

load images in list without stopping execution

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eric Georgiades
    wrote on last edited by
    #1

    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

    D N 2 Replies Last reply
    0
    • E Eric 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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • E Eric 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

        N Offline
        N Offline
        nlarson11
        wrote on last edited by
        #3
        1. 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.
        E 1 Reply Last reply
        0
        • D Dave Kreskowiak

          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

          E Offline
          E Offline
          Eric Georgiades
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • N nlarson11
            1. 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.
            E Offline
            E Offline
            Eric Georgiades
            wrote on last edited by
            #5

            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

            N 1 Reply Last reply
            0
            • E Eric 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

              N Offline
              N Offline
              nlarson11
              wrote on last edited by
              #6
              1. load the listbox 2) then use the same dataset to load the images.
              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups