My main Form, named Form1 has a class with an event which indicates that Form1 should be Closed.
When I receive the event and try to Close
I get the excepcion that a control.invoke must be used. Fine, I make the call with this code and I'm still getting the same exception:
void Prox_OkEvent(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
callControlhandler c = new callControlhandler(CloseForm);
c.Invoke();
}
else Close();
}
private void CloseForm()
{
try { this.Close(); }
catch (Exception e) { MessageBox.Show(e.Message); }
}
Where is the problem? thanks for any help