I have MDI application and opeing new form on focus/selection. To avoide opening of the same image more than once I have written this piece of code but it has a problem
private void lstview1_MouseDoubleClick(object sender, MouseEventArgs e)
{
string window_name= this.lstview1.FocusedItem.Tag.ToString();
if (this.MdiChildren.Count() > 0)
{
if ( window_name == this.MdiChildren[i].Tag.ToString()) // At this point need ur help
{
this.MdiChildren[i].Activate();
}
else
{
Image_show_form(image, window_name);
}
}
else
{
Image_show_form(image, window_name);
}
}
where childform tag is again int.parse(window_name). but it throws error which makes sensce [ this.MdiChildren[index].Tag] needs to exist first. How can I ckeck this existance / or how can I make my code better.