I know, this may be a very easy question yet I couldn't be sure. I have this in a module:
Public theHandle As IntPtr
And this in my main form named Form1:
Private Sub Form1_HandleCreated(sender As Object, e As System.EventArgs) Handles Me.HandleCreated
theHandle = Me.Handle
End Sub
I have many other classes, modules and threads and without using InvokeRequired
, I am using this for invoking delegates from everywhere. I mean from other threads, classes, modules etc..
DirectCast(Form1.FromHandle(theHandle), Form1).Invoke(D_Calculate)
instead of:
D_Calculate.Invoke()
Is it a bad practice? Is there really a purpose of checking for InvokeRequired
everytime?