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. Windows Forms
  4. Accessing ListBox from multiple threads

Accessing ListBox from multiple threads

Scheduled Pinned Locked Moved Windows Forms
databasequestion
5 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.
  • M Offline
    M Offline
    Mr Brainley
    wrote on last edited by
    #1

    I have a multithreaded application, and want to access a ListBox from multiple threads. However, if i add an item to the ListBox from a thread different from the one it was created in, the changes are only shown, once i trigger a refresh from the creation thread. Is there any way around that ?

    G F 2 Replies Last reply
    0
    • M Mr Brainley

      I have a multithreaded application, and want to access a ListBox from multiple threads. However, if i add an item to the ListBox from a thread different from the one it was created in, the changes are only shown, once i trigger a refresh from the creation thread. Is there any way around that ?

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      Beginners Guide To Threading In .NET Part 5 of n[^]

      Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

      M 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        Beginners Guide To Threading In .NET Part 5 of n[^]

        Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

        M Offline
        M Offline
        Mr Brainley
        wrote on last edited by
        #3

        Thanks, i also found help here[^].

        G 1 Reply Last reply
        0
        • M Mr Brainley

          Thanks, i also found help here[^].

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          Nice to see that you got it working :)

          Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

          1 Reply Last reply
          0
          • M Mr Brainley

            I have a multithreaded application, and want to access a ListBox from multiple threads. However, if i add an item to the ListBox from a thread different from the one it was created in, the changes are only shown, once i trigger a refresh from the creation thread. Is there any way around that ?

            F Offline
            F Offline
            Fadi Yoosuf
            wrote on last edited by
            #5

            You have to use BeginInvoke method of the control while modifying the controls' property from a different thread other than which the control was created on. refer the link http://msdn.microsoft.com/en-us/library/a06c0dc2.aspx hope it solves ur problem

            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