I'm trying to open a form
after a label
is double clicked
.
My Code:
else if (e.Clicks == 2)
{
foreach (var control in myFLP.Controls)
{
if(control is Label)
{
var Id = mylabel.Name.ToString();
int personID;
if (!String.IsNullOrWhiteSpace(Id) && int.TryParse(Id, out personID))
{
Form frm = new Form(_controller, personID);
frm.ShowDialog();
frm.Dispose();
}
else
{
Form2 frm2 = new Form2();
frm2.ShowDialog();
frm2.Dispose();
Console.WriteLine("Hello");
}
}
}
}
When i double click
on the label
nothing happens? So i tried calling Form frm = new Form();
without passing any parameters. The form opened after the double click
, but kept opening for every label in the myFLP
?
Edit 1:
I have added an ELSE
. I think my condition in incorrect.