Close a form from an external thread using the Invoke method
问题 I have to close a Form from a thread and I am using the Invoke method of the Form for calling the Close() method. The problem is that when closing, the form is disposed and I get an InvalidOperationExecption wit the message "Invoke or BeginInvoke cannot be called on a control until the window handle has been created.". I have got this exception only when debugging with a "Step Into" in the Close method but I don't want to risk with a possible error on normal running. This is an example code