Printing Children

How can I set my menu to print a child if it is open? If the child is not open, I don't want it to print. In fact, I want the print option disabled.
[149 byte] By [codefund.com] at [2007-12-16]
# 1
In the Click event of the parent menu (the one at the top, where you click to bring up the dropdown menu containing Print), add code to check the MdiChildren collection. If its length is 0, you know to disable the Print item:

Private Sub mnuFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile.Click
mnuPrint.Enabled = (Me.MdiChildren.Length > 0)
End Sub

That should do it.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
That did the trick!
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
Except, of course (for those reading this later), it didn't--you need to use the Popup event, not the Click event, to get this to work correctly. (Just updating the thread for posterity... <g>)
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...