Thursday, October 21, 2010

I want to close MDI child form from MDI Parent Form in Vb.net?

I am developing a project in vb.net. I am using Log off button on MDI Parent form. How to close all the opend MDI child form when click the ';log off'; button on MDI Parent form?I want to close MDI child form from MDI Parent Form in Vb.net?
* If the button is in one of the child forms:



Perform this loop in the button's click event:



For Each child As Form In Me.MdiParent.MdiChildren

If chile %26lt;%26gt; Me Then

child.Close ()

End If

Next child



* If the button belongs to the MDI Parent Form:



Perform this loop in the button's click event:



For Each child As Form In Me.MdiChildren

child.Close ()

Next child

No comments:

Post a Comment