![]() | Type | Description | ||
| Cancel as Variant | A Boolean expression that specifies whether to cancel showing the drop down portion of the control. |
Use the DropDown and DropUp events to notify your application that the drop-down portion of the control is shown or hidden. Use the DropDown event to cancel showing the drop down portion of the control based on your condition. The DropDown and DropUp events are fired only if the control's Style property is DropDown or DropDownList. Use the hWndDropDown property to get the handle of the drop down window. Use the DropDown method to show programmatically the drop down portion of the control. The AutoDropDown property retrieves or sets a value that indicates whether the control's list automatically drops down once the user starts type into it.
The following VB sample disable showing the drop down portion of the control if there is no items:
Private Sub ComboBox1_DropDown(Cancel As Variant)
Cancel = ComboBox1.Items.ItemCount = 0
End Sub