I have a function that helps me close forms without getting crossthread errors:
public void OutsideClose(long Id)
{
MessageBox.Show("");
if (InvokeRequired)
{
Invoke(new Action<long>(OutsideClose), Id);
}
else
{
var asdf = ListForm.Find(a => a.Id == Id);
if (asdf != null)
{
asdf.Close();
}
}
}
For some reason, if I call this invoke twice, instead of closing the form the second time, it goes to this dispose method:
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
I want the form to close, and have no idea what is going on...