Updating mainform when threading is in seperate unit

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hello all,

How can I update the mainform (using Control.Invoke) when my threading is in
a seperate (function) unit ?
Somehow I can not get it to work...
When the threading is inside the mainform everything is working OK, but I
need to call the threading also from other forms.

Thanks for any ideas

Peter.
 
You can create a public event in the second form and raise that event in the
new thread in the second form. Have your first form handle the event of the
second form (i.e. CatchEvent(sender as object, e as events) Handles
NewForm.TheEvent. Then use me.invoke to update the UI in the first form.
 
If I correctly understand you then just pass a reference of the main
form for this unit and then use something like "_form.Invoke".
 
Back
Top