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. Threading passing parameters to thread

Threading passing parameters to thread

Scheduled Pinned Locked Moved C#
jsonhelp
4 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
    Muhammad Nauman Yousuf
    wrote on last edited by
    #1

    I Have a function that takes arguments and process and return a dataset (the scenario is working fine), Now i need to put my function in thread but unable to find any way to pass arguments to thread and take return argument from thread. Totally clueless to threads, Please Help!!!! Thank you! M. Nauman Yousuf

    "Mess with the Best, Die like the rest"

    L J 2 Replies Last reply
    0
    • M Muhammad Nauman Yousuf

      I Have a function that takes arguments and process and return a dataset (the scenario is working fine), Now i need to put my function in thread but unable to find any way to pass arguments to thread and take return argument from thread. Totally clueless to threads, Please Help!!!! Thank you! M. Nauman Yousuf

      "Mess with the Best, Die like the rest"

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

      Hi, have a look at the BackgroundWorker class, that is intended for such situations. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      M 1 Reply Last reply
      0
      • M Muhammad Nauman Yousuf

        I Have a function that takes arguments and process and return a dataset (the scenario is working fine), Now i need to put my function in thread but unable to find any way to pass arguments to thread and take return argument from thread. Totally clueless to threads, Please Help!!!! Thank you! M. Nauman Yousuf

        "Mess with the Best, Die like the rest"

        J Offline
        J Offline
        justintimberlake
        wrote on last edited by
        #3

        if you are using framework 2 then i think there is some thing called parametrize thread. if you are using frame work 1.1 then have a function in a different class which doesnt take any parameter but use class level variabe in that class pass the parameter through constructor and and in the method use those mvariable. and call that method using thread.

        1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, have a look at the BackgroundWorker class, that is intended for such situations. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          M Offline
          M Offline
          Muhammad Nauman Yousuf
          wrote on last edited by
          #4

          I will look in to it, thx Luc Pattyn

          "Mess with the Best, Die like the rest"

          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