MDI RadRibbonForm - Close all Child MDIs

2 posts, 0 answers
  1. Jimmy
    Jimmy avatar
    1 posts
    Member since:
    Jul 2014

    Posted 12 Dec 2014 Link to this post

    Hi,

    I'm unable to close all MDI childs in once.
    I've used the following code:

    Public Class RadRibbonForm1
     
        Private Sub RadButtonElement1_Click(sender As Object, e As System.EventArgs) Handles RadButtonElement1.Click
            Dim childForm As New Form()
            childForm.Text = "MDI Child " & DateTime.Now.ToShortTimeString()
            childForm.MdiParent = Me
            childForm.Show()
        End Sub
     
        Private Sub RadButtonElement2_Click(sender As Object, e As System.EventArgs) Handles RadButtonElement2.Click
            Dim frmChild As Form
     
            For Each frmChild In Me.MdiChildren
                frmChild.Close()
            Next
        End Sub
     
        Public Sub New()
            ' This call is required by the designer.
            InitializeComponent()
     
            ' Add any initialization after the InitializeComponent() call.
            Me.IsMdiContainer = True
     
            With Me.RadDock1
                .AutoDetectMdiChildren = True
                .ShowDocumentCloseButton = True
                .ToolWindowInsertOrder = Telerik.WinControls.UI.Docking.DockWindowInsertOrder.ToBack
            End With
        End Sub
    End Class
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 17 Dec 2014 Link to this post

    Hi Jimmy,

    Thank you for writing.

    You can close the windows by using the the CloseAllWindows method of the dock:
    Private Sub radButton2_Click(sender As Object, e As EventArgs)
        radDock1.CloseAllWindows()
    End Sub

    Detailed information can be found here: Removing ToolWindow and DocumentWindow at Runtime.

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top