I encounter a problem with a Windows Forms application.
A form must be displayed from another thread. So in the form class, I have the following code:
You could always try testing against a different control.
For example, you could access Application.Forms collections
public Control GetControlToInvokeAgainst()
{
if(Application.Forms.Count > 0)
{
return Application.Forms[0];
}
return null;
}
Then in your DisplayDialog() method, call the GetControlToInvokeAgainst() and test for null before trying to perform an invokerequired call.