| How to DropDown darn near anything |
Applies To |
|
| OS: VB: |
NT, 9x, 2000 5, 6 |
|
There is the proper way to programmatically show the DropDown portion of the ComboBox, DTPicker, DataCombo, etc... and then there is the easy way. The proper way is to use the API command to send a message to these controls. That makes it difficult to have a generic routine, because each control expects a different message.
Then there is the easy way. All of these controls drop down when the user presses F4. So why not press it for them using SendKeys statement.
For instance, you can show the DropDown for Combo1 by executing the following:
Combo1.SetFocus
SendKeys "{F4}"
Thus, we create a generic routine to show the DropDown:
Sub ShowDropDown(ctl as Control)
'pass in the control to drop down
ctl.SetFocus
SendKeys "{F4}"
End Sub