MainForm.Invoke(New MethodInvoker(AddressOf MainForm.Controls.Add))
Yeah that doesn't work and I know it's not what you told me to do, lol I'm
sorry. Its as if I am wanting to do this.
I have form1, it is going to do some calculations for a bit, I cannot escape
that fact as form1 is my main application form. What I want to do is create
a new thread that will add a control to form1 (that covers the entire form)
and display a bussy animation. Problem is VB wont let me add a control to a
form on a different thread. I'm certain what you gave me will work I guess
I just do not understand what I am supposed to do.
This is my code, Mainform is essentially form1 as described above.
'simple code to display bussy notification
Public mrg_p As wait
Private t As Threading.Thread
Public Sub show_bussy()
t = New Threading.Thread(AddressOf bussy)
t.Start()
End Sub
Private Sub bussy()
If mrg_p IsNot Nothing Then mrg_p.Dispose()
mrg_p = New wait
'MainForm.Controls.Add(mrg_p)
' f.Invoke(New MethodInvoker(AddressOf f.YourMethod))
MainForm.Invoke(New MethodInvoker(AddressOf MainForm.Controls.Add))
MainMarque.Visible = False
With mrg_p
.Top = 0
.Left = 0
.Dock = DockStyle.Fill
End With
MakeWindowAlwaysTop(mrg_p.Handle.ToInt32)
mrg_p.Show()
mrg_p.Visible = True
End Sub
Public Sub hide_bussy()
t.Abort()
End Sub