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. C#
  4. How to pass ArrayList object back from a Thread

How to pass ArrayList object back from a Thread

Scheduled Pinned Locked Moved C#
tutorialcsharpc++question
2 Posts 2 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.
  • L Offline
    L Offline
    largenqcd
    wrote on last edited by
    #1

    I've written multithreaded code using MFC and understand that well. I'm working on a C# code in which I want to fill in an ArrayList with some data, using a separate thread, and then use the ArrayList data to populate a ListBox on my Form. Can someone point me to a good example of how to pass data back from a thread in C#? I've found some examples using BackgroundWorker ..., but I'm not sure if that is the only way, or the best way, etc. None of my C# books have anything but very simple threading examples. Thanks,

    Tom

    L 1 Reply Last reply
    0
    • L largenqcd

      I've written multithreaded code using MFC and understand that well. I'm working on a C# code in which I want to fill in an ArrayList with some data, using a separate thread, and then use the ArrayList data to populate a ListBox on my Form. Can someone point me to a good example of how to pass data back from a thread in C#? I've found some examples using BackgroundWorker ..., but I'm not sure if that is the only way, or the best way, etc. None of my C# books have anything but very simple threading examples. Thanks,

      Tom

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      This article[^] will tell you how your thread can access the GUI parts. And yes a BackgroundWorker often is the best way to achieve this. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      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