C# - Keep track of open child forms

Posted by Nate Shoffner on Stack Overflow See other posts from Stack Overflow or by Nate Shoffner
Published on 2010-12-31T00:46:26Z Indexed on 2010/12/31 0:53 UTC
Read the original article Hit count: 186

Filed under:
|

I currently have a parent control (Form1) and a child control (Form2).

Form1 contains a listview that stores a list of of file data (each file is a separate item).

Form2 contains only a textbox.

Upon clicking on one of these listviewitems in Form1, Form2 is opened up and accesses the file's data and loads it into the textbox in Form2 in plain text format.

The issue I'm having is, I would like to be able to detect, upon clicking of a listviewitem, whether that file is already opened in said child form and if so, to activate it (bring it to the front) and if it is not already opened, open it. I'm not sure what the best method of doing this would be since this can involve many child forms being open at once. This is not an MDI application. Any ideas on how this could be accomplished are appreciated and samples even more so. Thank you.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms