I have a method that works, but when I click a link the first time the new form opens as it should. I then have in the method to check to see if the new form is open by using a bool variable. This works properly, but requires that I click the button twice before it will perform. What is causing this? Any Ideas or Suggestions? I have attached my code below for the Method.
Code:
private void lblClose_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Form intiatedForm = null; /* creates an instance to a new form. Used to open another form when called.*/
if (openForm == false)
{
intiatedForm = new frmClose();
intiatedForm.Show();
openForm = true;
}
else if (openForm == true)
{
FormCollection _forms = Application.OpenForms;
foreach (Form a in _forms)
{
if (a is frmClose)
{ openForm = true; }
else openForm = false;
}
}
}
Comment