How to expand combo box on focus event?
11,944
What about check if already DroppedDown ?
Private Sub cmbElectLoadPS_gotfocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbElectLoadPS.GotFocus
if Not cmbElectLoadPS.DroppedDown Then
cmbElectLoadPS.DroppedDown = True
End If
End Sub
If u need this behavior for all your combo controls is better to create your own implementation
Pulic Class CustomComboBox
Inherits ComboBox
Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
if Not DroppedDown Then
DroppedDown = True
End If
End Sub
End Class
Related videos on Youtube
Comments
-
Myth almost 2 years
I want to automatically expand Combo box on focus event. I have set the
Droppeddown = True
in gotfocus event, but this has a side effect. When click event gets fired, it expands dropdown and closes immediately. How can I avoid it?Here is Code:
Private Sub cmbElectLoadPS_gotfocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbElectLoadPS.GotFocus cmbElectLoadPS.DroppedDown = True End Sub
-
ACP over 14 yearscould you post some code
-
-
Myth over 14 yearsIts working, but as u said, not the best soln as its showing twice. is there any better way?