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
        Next

        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
        Else
        End If

    End Sub

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.