I have tried the following:
foreach (Form f in this.MdiParent.MdiChildren
{
if (f.Name == name)
{
Form f2 = f;
f2.UpdateDB();
}
}
however, this encounters a problem with "f2.UpdateDB()" because I cannot reference the method in each instance of f2. Is there any way to get around this problem?
Main Topics
Browse All Topics





by: gerry99Posted on 2005-02-04 at 14:20:58ID: 13230528
I think you will need to go through your MDI parent form. In your MDI parent create a collection, that you can add each of your MDI child forms to. When a child is closing, override the Close method, and call your method on your Parent class to notify each MDI child in that collection that needs to know that the other view is closed. (And remove the view that is closing from that collection.)
BTW, what I find most frustrating about .NET forms, is the way they assume that you want to use keyboard shortcuts in whatever way has been pre-defined. I have a form containing a panel and a listbox. When the listbox is not added, I can use arrow keys to move a line across the panel, once the list box has been added it captures *all* key stroke events.