Click here to Skip to main content
15,916,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

1. I am making an application in which i am using mdiform and having multiple child form

2. I am using previous and next button to navigate from one child to another

following is my code
VB
Private Sub Form1_MdiChildActivate(sender As Object, e As EventArgs) Handles MyBase.MdiChildActivate
       Dim frmact = Me.ActiveMdiChild
       Dim i = Array.IndexOf(Me.MdiChildren, frmact)

       If i = 0 AndAlso Me.MdiChildren.Length = 1 Then
           btnNext.Enabled = False
           btnPrevious.Enabled = True
       ElseIf i = 0 AndAlso Me.MdiChildren.Length > 1 Then
           btnNext.Enabled = True
           btnPrevious.Enabled = False
       ElseIf i = Me.MdiChildren.Length - 1 Then
           btnNext.Enabled = False
           btnPrevious.Enabled = True
       Else
           btnNext.Enabled = True
           btnPrevious.Enabled = True
       End If

       If Me.ActiveMdiChild Is Nothing Then
           btnNext.Enabled = False
           btnPrevious.Enabled = False

       End If
   End Sub

but when i am closing the mdichild form mdichildrenlength showing in correct
If you have any solution then i like to use that solution

Thanks in advance
Posted
Updated 24-Jul-15 3:17am
v3

1 solution

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages,
How to Create MDI Parent Window in WPF?.

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF?,
Question on using MDI windows in WPF,
MDIContainer giving error,
How to set child forms maximized, last childform minimized,
Why MDI form is not supported natively in WPF ?[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900