I have placed a button controls in center the mdi. But when I an opening a child forms, the forms appears below the button
Please help ?
I Used this coding but it didn't work..............

  Private Sub MDIFORM_MdiChildActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate

        Dim cnt As Integer = 0
        For Each frm As Form In My.Application.OpenForms
            cnt += 1

        If cnt >= 1 Then
            Me.Button1.Visible = False
            Me.Button2.Visible = False
            Me.Button3.Visible = False
        ElseIf cnt = 0 Then
            Me.Button1.Visible = True
            Me.Button2.Visible = True
            Me.Button3.Visible = True
        End If

    End Sub
5 Years
Discussion Span
Last Post by nmaillet

First, you should be using the MdiChildren property, not OpenForms, and the event is not going to fire at the appropriate times (mainly on closing) for your purposes. I could go deeper into it, but I'd rather recommend you not add anything to an MDI container except MDI child forms (with the exception of menus and toolbars of course). Instead, you should add a menu or toolbar, and use that to perform any actions.

I would actually recommend that you do not use MDI at all. As far as I know, Microsoft is not doing any more development for MDI in .NET, and there are some outstanding bugs yet to be resolved.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.