astonk2
October 15th, 2001, 09:51 AM
I have a MDIForm with children. Each child has a Public function child_close(). How can call the child_close() function of all my childern whenever the MDIForm is closing. Thanks for any help I know this is a simple task.
Cimperiali
October 15th, 2001, 10:21 AM
'this will work only in queryUnload of parent form:
'if you put this in the unload, the children will be already unloaded.
private Sub MDIForm_QueryUnload(Cancel as Integer, UnloadMode as Integer)
Dim frm as Form
for Each frm In Forms
If frm.Name <> me.Name then
If frm.MDIChild = true then
frm.child_close
End If
End If
next
End Sub
'another way: you may put the call to child_close
'in the unload event of each child
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
astonk2
October 15th, 2001, 10:35 AM
Thanks alot.That worked just fine.