See Also Example
Applies To
Combo box.
Description
Occurs when the list portion of a combo box is about to drop down; this event does not occur if a combo box's Style
Syntax
Sub ctlname_DropDown (Index As Integer)
Remarks
The argument Index uniquely identifies a control if it is in a control array Use a DropDown procedure to make final updates to a combo box list before the user makes a selection. This allows you to add or remove items from the list, using the AddItem or RemoveItem methods. This flexibility is useful when you want some interplay between controlsfor example, if what you want to load into a combo box list depends on what the user selects in an option button group.
Help:
Style Property
Programmer's Guide:
Chapter 12, "Responding to Mouse Events"
The example updates a combo box based on the user's selection in an option button group. To try this example, paste the code into the Declarations section of a form that contains a combo box and two option buttons. Set the Name property of both option buttons to OptionGroup. Then press F5 and click the option buttons. The combo box reflects different carriers depending on the option button selected.
Sub Form_Load ()
Combo1.Text = "" ' Clear combox box.
End Sub
Sub Combo1_DropDown ()
While Combo1.ListCount ' Delete existing items.
Combo1.RemoveItem 0
Wend
If OptionGroup(0).Value = True Then
Combo1.AddItem "Gray Goose Express", 0
Combo1.AddItem "Wild Fargo Carriers", 1
Else
Combo1.AddItem "Pegasus Overnight"
End If
End Sub