Hello,
I'd like to get the handle of my form from a different class(probably thread). I want to do it the way I do invoke
public int GetHandle
{
get
{
if (this.InvokeRequired)
{
this.Invoke((MethodInvoker)delegate
{
return this.Handle.ToInt32();
});
}
}
}
I get an error "Since 'System.Windows.Forms.MethodInvoker' returns void, a return keyword must not be followed by an object expression"
If i don't use the invoke,I get an exception that I'm not calling the method from the current thread.