Accessing a loaded form

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can I get a handle to a currently loaded form instance and use that to
call one of form's methods?

Thanks
 
The form is the main form of my app and it has a status bar. I need to
display text in status bar from various subs in modules outside of the form.
What is the best mechanism?

Thanks

Regards
 
John said:
The form is the main form of my app and it has a status bar. I need
to display text in status bar from various subs in modules outside
of the form. What is the best mechanism?

If the code in the modules refer to the Form, you should move the code
from the modules into the Form. Without the Form, the code won't run
anyway.

If you want to write more abstract code, you can cut the relation to the
Form. Instead, declare and raise an event in the Module. The Form can
catch the event and update the statusbar.

Be aware that long running code makes the UI inoperatable. Even short
running code can lead to inoperatable ghost windows that don't reflect
changes in your status bar. In this case you should consider executing
the code in another thread.


Armin
 
Back
Top