|
-
Jul 21st, 2004, 06:03 AM
#1
Thread Starter
Addicted Member
last MDI child form closed
I've a VB.NET MDI application in which I use Menus to allow the user to open Child forms like this:
Dim NewMDIChild As New frmMyChildForm
NewMDIChild.MdiParent = Me
NewMDIChild.StartPosition = FormStartPosition.CenterScreen
NewMDIChild.Show()
I also have a SplashScreen as a Child form that is opened with the MDI form, and which I close when any other Child form is opened.
The problem is this: How do I know when to show the splash form again?
I have tried various events of the Parent to count the number of childeren, but cannot get this to work. Activate just fires at wrong time, gotFocus is no use either.
any ideas?
-
Jul 21st, 2004, 06:55 AM
#2
Hi.
You could add an eventhandler to each child when it's opened.
VB Code:
Dim NewMDIChild As New frmMyChildForm
NewMDIChild.MdiParent = Me
NewMDIChild.StartPosition = FormStartPosition.CenterScreen
NewMDIChild.Show()
AddHandler NewMDIChild.Closed, AddressOf ChildClosed
Private Sub ChildClosed(ByVal sender As Object, e As EventArgs)
'Check ActiveMdiChild or MDIChildren.Length to determine wether to show Splash
End Sub
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Jul 21st, 2004, 07:39 AM
#3
Hyperactive Member
While this does work, it only works if you test your child length to equal 1:
VB Code:
Private Sub DecrementChildren(ByVal sender As Object, ByVal e As EventArgs)
If Me.MdiChildren.Length = 1 Then
frmSplash = New frmProperties
frmSplash.Show()
End If
End Sub
This code will show the spalsh form but resluts in an unreleased object reference that prevents your mdi form from unloading. Still looking into it.
I am guessing that some form of Interface will probably be of use here.
Whadayamean it doesn't work....
It works fine on my machine!

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
|