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. Invoke/Thread Error

Invoke/Thread Error

Scheduled Pinned Locked Moved C#
helpdata-structures
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.
  • R Offline
    R Offline
    Rabbit17
    wrote on last edited by
    #1

    I get the following when trying to build a tree from the following code: The action being performed on this control is being called from the wrong thread. I thought I was using the correct BeginInvoke. Thanks for any help! private void main() { ... SetRunCollectionTree srct = new SetRunCollectionTree(this.RunCollectionTree); srct.BeginInvoke(null, null); } public delegate void SetRunCollectionTree(); public void RunCollectionTree() { try { this.collectionTree.BuildTree(); } catch(System.Exception e) { MessageBox.Show(e.Message); } }

    RABB17 "Nothing fancy needed, please just solve all our problems as quickly as possible."

    M 1 Reply Last reply
    0
    • R Rabbit17

      I get the following when trying to build a tree from the following code: The action being performed on this control is being called from the wrong thread. I thought I was using the correct BeginInvoke. Thanks for any help! private void main() { ... SetRunCollectionTree srct = new SetRunCollectionTree(this.RunCollectionTree); srct.BeginInvoke(null, null); } public delegate void SetRunCollectionTree(); public void RunCollectionTree() { try { this.collectionTree.BuildTree(); } catch(System.Exception e) { MessageBox.Show(e.Message); } }

      RABB17 "Nothing fancy needed, please just solve all our problems as quickly as possible."

      M Offline
      M Offline
      mdv113
      wrote on last edited by
      #2

      In Vs2005 dotnet2.0 it is not permitted to access a form control from a different thread then the owner thread. You must use a callback to do this. See http://support.microsoft.com/kb/318604[^] mdv113

      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