6
Answers

Raising event in another form

Ask a question
Hi

I'm a bit new to custom events and delegates so I'm having problem to get a good solution to this problem.

I've got an MDI app that can load several forms as child-forms, all with different contents.

It can also show a .showdialog form for input of new data and on exiting this form the MDI form needs to notify one of the loaded Child forms that it's data has been changed and its time to reload the list content.

So, How can I raise an Event in one loaded Child form from the MDI form?


I can use something similar to this function to find out IF the child form is loaded or not.
(I'm using this function to avoid loading the same child form twice)

public static bool ShowThisChildWindow(String WinTagName)
{
      foreach (Form childForm in Application.OpenForms)
      {
         if (childForm.Tag != null)
         {
            if (childForm.Tag.ToString() == WinTagName.ToString())
            {
                childForm.BringToFront();
                return true;
            }
         }
       }
   return false;
}



Best Regards

Kjell


Answers (6)