Toggle properties enable/disable

I'm using the following code with no success.  If the panel's visible I want combobox1 disabled and if the panel's not visible I want combobox1 enabled again. Any better suggestions on a code to use I have also tried Update() with no success inplaced of Refresh()


Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

If Panel1.Visible = True Then

ComboBox1.Enabled = False

ComboBox1.Refresh()

End If

If Panel1.Visible = False Then

ComboBox1.Enabled = True

ComboBox1.Refresh()

End If

End Sub



Answer this question

Toggle properties enable/disable

  • Floyd Gladden

    There is a visiblechanged event, OnPaint is the wrong place to be doing this.

  • Alain B-H

    Where would be a good place to put it then
  • Ian George

    The visiblechanged event.


  • Toggle properties enable/disable