How to Programmatically Display or Hide a VB Combo Box List (85991)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q85991 SUMMARY
The list of a Visual Basic drop-down combo box (Style=0 or 2) is
usually opened and closed by using a mouse. However, you can also
open and close the list of a combo box programmatically by using the
Windows SendMessage function as described below.
However, there is an easy way. In visual basic, when a drop-down combo box
has the focus, you can press ALT-DOWN to open it up. Therefore, you can use
SendKeys to send these keys to the combo box, as in this example:
To do this programmatically, use the following code to change focus to the
combo box and send the necessary keystroke:
combo1.SetFocus
SendKeys "%{Down}"
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | KB85991 |
---|
|