problem with closing parent of mdi child

  • Thread starter Thread starter mutant
  • Start date Start date
M

mutant

Guest
Hi.
I have a MDI child form, in closing handler i have:
Visual Basic:
Private Sub frmForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
End Sub
I dont want the user to be able to close the mdi child by clicking x cause its vital to my app. When i do that i cant close mdi parent either. Can anyone point me to some soultion?
Thanks.
 
Can you add a button on the child form, that simply does: "Me.Hide()"....I don't totally understand what you are trying to accomplish, but maybe this will do it? It will keep the form from closing, but get you back to the parent form to close it.
 
Thats the problem, the mdi child is supposed to be empty, without any controls. When i press the x button on the right upper side of the child i dont want it to close, but when i click the x button on parent i want to close it. It wont let me do this.
I cant have a button cause i need the child empty.
 
Try setting the Forms ControlBox Property to False. This way the form will not show an X close box, and can't be closed using CTRL-F4. Remove the e.Cancel = True from the closing sub.
 
Last edited:
:) I was trying it too.
Man who thought of not letting main form close cause child form wont close... MS is smart (:( )
 
Back
Top