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. about threading

about threading

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 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.
  • A Offline
    A Offline
    Abhishek Joshi
    wrote on last edited by
    #1

    Hi all I created a thead and textbox in a class and try to set value of textbox from another created thread. But error comes that Resources held by main thread as TextBoxes are held by main thread. What to do in this case? :confused:

    #Abhi#

    S E 2 Replies Last reply
    0
    • A Abhishek Joshi

      Hi all I created a thead and textbox in a class and try to set value of textbox from another created thread. But error comes that Resources held by main thread as TextBoxes are held by main thread. What to do in this case? :confused:

      #Abhi#

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Take a look at this article here on CP: What's up with BeginInvoke?[^]


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • A Abhishek Joshi

        Hi all I created a thead and textbox in a class and try to set value of textbox from another created thread. But error comes that Resources held by main thread as TextBoxes are held by main thread. What to do in this case? :confused:

        #Abhi#

        E Offline
        E Offline
        ednrgc
        wrote on last edited by
        #3

        Only the main thread can update an item on a form.

        L 1 Reply Last reply
        0
        • E ednrgc

          Only the main thread can update an item on a form.

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

          Hi, in .NET 1.x you could try it from another thread and it might work (most of the time), or it could result in forms with a white menu bar on top (I'm sure you have seen these already, even on non-.NET code). in .NET 2.0 and up it gets rejected by default; you must set it up in such a way that all controls get handled completely by the thread that created them, often called "the UI thread" or "the main thread". For some simple examples, look at either one of my articles. :)

          Luc Pattyn

          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