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. Thread Safe or not ...

Thread Safe or not ...

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestionbeta-testinghelp
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.
  • B Offline
    B Offline
    brunoconde
    wrote on last edited by
    #1

    Hello !! :confused: I've been programing in Visual Studio 2003 and now i change IDE to Visual Studio 2005 Beta 2 and of course .NET 2.0 Beta. I converted the project i was doing and i run it. It show lots of runtime errors of Thread Safe because it looks like Windows.Forms is no longer a Thread safe operation (why have they change this???? don't have a clue). How can i call these objects in another thread? i know it has something to do with "Delegate" or "control.Invoke" but i think this has change too. Please help me. :( thanks !! ;) Sorry for my English... Bruno Conde pharaoh

    D S J 3 Replies Last reply
    0
    • B brunoconde

      Hello !! :confused: I've been programing in Visual Studio 2003 and now i change IDE to Visual Studio 2005 Beta 2 and of course .NET 2.0 Beta. I converted the project i was doing and i run it. It show lots of runtime errors of Thread Safe because it looks like Windows.Forms is no longer a Thread safe operation (why have they change this???? don't have a clue). How can i call these objects in another thread? i know it has something to do with "Delegate" or "control.Invoke" but i think this has change too. Please help me. :( thanks !! ;) Sorry for my English... Bruno Conde pharaoh

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

      The operations that you speak of were allow to be written in kind of a shortcut fashion in 2003, but shouldn't have been. You have to rewrite the code to follow the more strict threading rules of 2005. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • B brunoconde

        Hello !! :confused: I've been programing in Visual Studio 2003 and now i change IDE to Visual Studio 2005 Beta 2 and of course .NET 2.0 Beta. I converted the project i was doing and i run it. It show lots of runtime errors of Thread Safe because it looks like Windows.Forms is no longer a Thread safe operation (why have they change this???? don't have a clue). How can i call these objects in another thread? i know it has something to do with "Delegate" or "control.Invoke" but i think this has change too. Please help me. :( thanks !! ;) Sorry for my English... Bruno Conde pharaoh

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        This[^] might help. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        • B brunoconde

          Hello !! :confused: I've been programing in Visual Studio 2003 and now i change IDE to Visual Studio 2005 Beta 2 and of course .NET 2.0 Beta. I converted the project i was doing and i run it. It show lots of runtime errors of Thread Safe because it looks like Windows.Forms is no longer a Thread safe operation (why have they change this???? don't have a clue). How can i call these objects in another thread? i know it has something to do with "Delegate" or "control.Invoke" but i think this has change too. Please help me. :( thanks !! ;) Sorry for my English... Bruno Conde pharaoh

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          Windows Forms has NEVER been thread safe! In fact, Win32 common controls have never been thread safe. Even the new UI coming in Windows Vista is not thread safe. In .NET 1.1, the application would run ok for awhile, but you'd run into subtle bugs eventually. In .NET 2.0, a error is issued if you try to use Windows Forms controls from another thread. If you want to use a Windows Forms control from another thread, use the Control.Invoke and Control.BeginInvoke methods:

          void CalledFromAnotherThread()
          {
          // Call textbox.Invalidate() method on the UI thread.
          myTextBox.Invoke((ThreadStart)myTextBox.Invalidate);
          }

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Cops & Robbers Judah Himango

          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