Hi Everyone,
in vb6 i was able to execute the following code and it would close the
children is the reverse order they were opened eg the last child
opened was the first child to close.
in mdiparent i had this code
i = Forms.Count - 1
Do Until i = 0
If Forms(i).Name <> "mdiMain" Then Unload(Forms(i))
i = i - 1
Loop
in the queryunload event of each child form i would prompt the user
if msgbox(msg) = vbyes then
'clean up objects etc
else
cancel = true
end if
setting cancel to true, seemed to kill the loop in the code in
mdiParent.
i have tried using in the new vbnet mdiParent form:
Dim f As Form
For Each f In Me.MdiChildren
if Not IsNothing(f) Then f.Close()
'somehow capture if the user has
'cancelled the close of a child form and exit loop
Next
in the closing event of each child
if msgbox(msg) = vbyes then
'clean up objects etc
else
e.cancel = true
end if
the forms seem to close in the order they are opened, however i would
prefer them to close in reverse order.
also, how can i capture if a user has canceled the form close event?
is there something already existing that i can check, i am not a fan
of setting global flags.
ideally, i would like the vb.net code equivalent of my old vb6 code
many thanks
Edwinah63