|
-
Nov 6th, 2003, 02:39 AM
#1
Thread Starter
Junior Member
How to close Forms in a MdiContainer (RESOLVED)
Hi there,
i am a newbie in VB.NET and now I wanted to create something like a paint application. I have already made a Form containing a MdiContainer. I am able to open multiple new forms in this Container, but I'm unable to close them.
I've used the following code in the Close_Click Event:
Environment.Exit(0)
and
Close()
but neither of them worked.
Could you please help me out?
Thanks
Last edited by Novice; Nov 6th, 2003 at 09:49 AM.
I know that I know nothing, therefore I know something.
-
Nov 6th, 2003, 07:40 AM
#2
Thread Starter
Junior Member
Here is the code I'am using to open the new forms into my MdiContainer:
Code:
Private Sub MainMenuFileNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainMenuFileNew.Click
Dim frmNew As New Form2()
frmNew.MdiParent = Me
frmNew.Show()
End Sub
Now how do I get the new Forms closed?
I don't think this is too much to a challenge, but too much for me.
Please help
I know that I know nothing, therefore I know something.
-
Nov 6th, 2003, 08:43 AM
#3
Thread Starter
Junior Member
All right, I've got it.
All you have to do is to write another 'Private Sub' which should be as follows:
Code:
Private Sub CloseSubForm()
Dim ActiveView As frmSubForm = CType(Me.ActiveMdiChild, frmSubForm)
ActiveView.Close()
End Sub
Then you have to write the following into your 'Button_Click'-Event:
Thanks anyway
I know that I know nothing, therefore I know something.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|