Results 1 to 3 of 3

Thread: Multi Threading - [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147

    Multi Threading - [RESOLVED]

    I have just started to look at multi-threaded apps after seeing Wokawidget's example. I was just wondering how you could refer to an object on the form frmThreadObject (MyThread) if you were to add some more functionality to the app and add a module/class etc.
    ie under normal circumstances if you have a label on the form and you wished to modify the text from a module you could use :
    frmThreadObject.lblInfo.Caption = "new text"
    However as in this example the form is named on creation, frmThreadObject wouldn’t exist.

    Any help to enlighten me would be much appreciated.
    Last edited by mik706; Jan 15th, 2004 at 03:46 AM.
    Mik706

  2. #2
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    You could store the form as a varible in a module?
    VB Code:
    1. Option Explicit
    2.  
    3. Public gfrmMain   As frmThreadObject
    Then in the form load event u would have:
    VB Code:
    1. Set gfrmMain = Me
    and in the unload event have:
    VB Code:
    1. Set gfrmMain = Nothing
    Make sense?
    Then to change the caption you would use:
    VB Code:
    1. gfrmMain.lblMyLabel.Caption = "Woof"
    Although why would you want to do this?
    I am sure there is a logical explanation...I am just tired

    Woka

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147
    Thanks for your reply, there is no logical reason in wanting to perform the example i gave but i couldn't work out how to reference the form, but as you have kindly provided me with the answer that is no longer a problem. Thanks again.
    Mik706

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