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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Form created by thread not responding

Form created by thread not responding

Scheduled Pinned Locked Moved Visual Basic
mobiledesignquestion
4 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
    RJGCarey
    wrote on last edited by
    #1

    I have a multithreaded program that draws stock market charts on as many as eight instances of a form. When I create instances of this form by clicking a menu item, they come up and are responsive to the user and the other threads. If I create a new instance from a thread other than the UI the form comes up but is not responsive to the user or the other threads. How does one do this? RCarey

    D 1 Reply Last reply
    0
    • R RJGCarey

      I have a multithreaded program that draws stock market charts on as many as eight instances of a form. When I create instances of this form by clicking a menu item, they come up and are responsive to the user and the other threads. If I create a new instance from a thread other than the UI the form comes up but is not responsive to the user or the other threads. How does one do this? RCarey

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

      The form won't work becuase it's not on the same thread as the application's message pump. Keystrokes and mouse clicks comming into the application have no way of getting to the form because they can't cros thread boundries. You have to modify your code so the form is created by the UI thread. You can still update the form from a background thread if you call BeginInvoke on the methods to need to call on the form. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        The form won't work becuase it's not on the same thread as the application's message pump. Keystrokes and mouse clicks comming into the application have no way of getting to the form because they can't cros thread boundries. You have to modify your code so the form is created by the UI thread. You can still update the form from a background thread if you call BeginInvoke on the methods to need to call on the form. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        R Offline
        R Offline
        RJGCarey
        wrote on last edited by
        #3

        That's where I am now. The arrival of a packet sets the text of a menu item on the main form to the stock's symbol and beeps. I have to click the menu item to create a new form. this works but when events are fast this is too slow. I tried changing the text of a label on the main form which throws an event. An event handles creates the form but it is still not responsive to the user. RCarey

        D 1 Reply Last reply
        0
        • R RJGCarey

          That's where I am now. The arrival of a packet sets the text of a menu item on the main form to the stock's symbol and beeps. I have to click the menu item to create a new form. this works but when events are fast this is too slow. I tried changing the text of a label on the main form which throws an event. An event handles creates the form but it is still not responsive to the user. RCarey

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

          RJGCarey wrote:

          tried changing the text of a label on the main form which throws an event

          Throws a what?? Are you saying it throws an Exception? You can't modify a control from anything other that the thread it was created on. Outside of that, you have to use BeginInvoke.

          RJGCarey wrote:

          An event handles creates the form but it is still not responsive to the user.

          Make absolutely SURE the correct thread is executing the code to create the new Form instance. You'll probably have to put together a method to create the Form instance and use BeginInvoke to call it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          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