How to Close VB Combo Box with ENTER keyLast reviewed: June 21, 1995Article ID: Q84474 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Visual Basic programming system for Windows, version 1.0
SUMMARYIf you open a combo box and then use the ARROW keys to scroll through it, pressing the ENTER key will not close the combo box like a mouse click will. This is normal behavior. The following example demonstrates how to make a combo box close when the ENTER key is pressed.
MORE INFORMATIONThe following program makes use of the Windows API SendMessage function to send the combo box the message to close. This is done only after the ENTER key is detected in the KeyPress event for the combo box. Two Windows API Declare statements must be added to your application. These can be added either in the GLOBAL.BAS module, or in the general Declarations section of the form containing the combo box.
Steps to Reproduce Behavior
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |