Click to See Complete Forum and Search --> : MDI form main menu shared w/child forms


rburks24
March 5th, 2003, 08:32 AM
I have a MDI application that will have several child forms associated with it. I want to use the MDI's main menu for these forms. For exapmle, when the user selects File-Open, I want to pass the OpenFileDialog file infromation into the child forms.
I am creating new instances of each child form from within the MDI main menu and declare the forms withEvents so I can detect when a child is closing.
I would appreciate it if someone can give me some direction on how to detect the MDI's main menu events within the active child form, or how to pass the information from the main menu's events to the active child form.
I have tried setting up an event handler, however, since the child form did not create the instance of the MDI form, it does not recieve the event.
See code that I have in the MDI form's main menu below.

'MDI main form with main menu
Public Class frmMain
Inherits System.Windows.Forms.Form
Dim WithEvents formImportCD As Form

'Open child form in MDI window
Private Sub mnuToolsImportFromCD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuToolsImportFromCD.Click
formImportCD = New frmImportCD()
formImportCD.MdiParent = Me
mnuToolsImportFromCD.Enabled = False
mnuFileClose.Enabled = True
formImportCD.Show()
End Sub

'Re-enable the menu for the child form when child has been closed
Private Sub formImportCD_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles formImportCD.Closed
mnuToolsImportFromCD.Enabled = True
End Sub
End Class




Thanks.