How can I loop through all the open instances of a particular form?
- by raz3r
I need to update a ListBox of a Form2 created dinamically. Let's say that in the event where I have to update this ListBox (in Form1 of course) I don't have a reference of this Form2 so I can't call the UpdateList method (and no, I can't make it static). I don't even know if there is a Form2 opened, it could be or not. What do you suggest? Is there a way to loop through all the open istances of Form2?
Code Sample:
//Form1
public void event()
{
//UPDATE FORM2 LISTBOX
}
//SOMEWHERE IN FORM1
Form2 runTime = new Form2();
//Form2
public void UpdateList()
{
//UPDATE LISTBOX
}