locked
minimize all open form RRS feed

  • Question

  • I have aprogram withtwo-form
    I want to minimize to the second interface all form opend are minimized
    I used code and  work fine


    But the problem now appears in Taskbar 2 icon

    I want to show only one icon on the taskbar when minimize all the interfaces or restore all interfaces by clicking on them

    in Taskbar

    code minimize all form

    Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
        ' Call the base class first
        MyBase.OnSizeChanged(e)
    
        ' See if this form was just minimized
        If Me.WindowState = FormWindowState.Minimized Then
            ' Minimize all open forms
            For Each frm As Form In Application.OpenForms
                frm.WindowState = FormWindowState.Minimized
            Next frm
        ElseIf Me.WindowState = FormWindowState.Normal Then
            ' Restore all open forms
            For Each frm As Form In Application.OpenForms
                frm.WindowState = FormWindowState.Normal
            Next frm
        End If
    End Sub


    Tuesday, June 26, 2018 10:59 AM

All replies

  • First you need to set the ShowInTaskbar property of the secondary form(s) to False so that they do not have their own Taskbar button.

    Second you need to loop through the open forms and set their state to Normal when the main form is restored, similar to what you did above to minimize all forms.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Tuesday, June 26, 2018 12:03 PM