Results 1 to 7 of 7

Thread: [2005] Update UI from a thread on another class!!!

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    77

    Unhappy [2005] Update UI from a thread on another class!!!

    Hi,

    This is one great article. Actually the best I have seen yet. I just have one issue if I may raise it here. I am not sure whether it should be on a spearate thread but if this is not the correct place please move it to wherever you see fit.

    Well, I have an issue with invoking my main from to update its UI from an external class rather than the same class like you explained. What I am doing is as follows:

    1. Declare a public delegate on the form
    2. Declare a public procedure on the form
    3. Spawn an instance of my external class and do some work and then update public variables in an external module.
    4. When done, I get a handle on the main form using
    Code:
    Application.OpenForms("mainForm")
    5. Invoke the UpdateUI procedure in the form like this:
    Code:
    Application.OpenForms("mainForm").Invoke(New UpdateGUIDelegate(AddressOfmainForm.UpdateUI))
    The code proceeds with no errors and by stepping through code I can see the textBoxes get assigned the value in the public variables. however, the form text boxes never show the new values!! I tried using application.doevents but no luck. I also tried adding a check on me.invokeRequired at the begining of the UpdateUI form but it always returned FALSE.
    Sample code here: Download 52K
    Please help..

    Thanks confused:
    Last edited by leedo2k; Aug 19th, 2008 at 11:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width