Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Events in module - pass back to main thread

Status
Not open for further replies.

KPharm

Programmer
Feb 1, 2001
38
US
I'm trying to find a way to pass back events from my thread inside of a MODULE back to the main thread but the following is illegal:

Public Class frmMain
Inherits System.Windows.Forms.Form

Private m_oThread As modMyThread
...

because modMyThread cannot be used as a TYPE. You may be asking, "Why not use a class for your thread code because you could easily use events to pass back info from the class?" Well, in the calling code (the main thread in my case), when I instantiate the class, then call to start the thread like:

private m_ClassMyThread as clsMyThread

clsMyThread.StartMyThread()

The problem is that my main thread will not get back control until StartMyThread has completed and this defeats the whole purpose of my multithreaded model.

So either a) How do I use events to pass back info from a module to the main app, or b) how can a class allow the main app to continue execution while the class is still running code - like a thread in my case?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top