Search code examples
vb.netevent-handlingvisibilityshow-hideformclosing

Hide CheckBoxes When Form is Minimized


I have three CheckBoxes that I need to hide whenever my form is closed or minimized. I know how do hide them with the FormClosing Event. Here is what I have for that:

Public Sub Tickers_Closed(sender As Object, e As EventArgs) Handles Me.FormClosing
    Nordeen_Investing_3.CheckBox_NASDAQ.Hide()
    Nordeen_Investing_3.CheckBox_NYSE.Hide()
    Nordeen_Investing_3.CheckBox_AMEX.Hide()
End Sub

How do I hide them when the form is minimized?


Solution

  • I used a combination of both answers. Here is what worked:

    Private Sub Tickers_Resize(sender As Object, e As EventArgs) Handles Me.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            Nordeen_Investing_3.CheckBox_NASDAQ.Hide()
            Nordeen_Investing_3.CheckBox_NYSE.Hide()
            Nordeen_Investing_3.CheckBox_AMEX.Hide()
        End If
    End Sub