Microsoft KB Archive/92382

= KeyUp Event On Menu Item Is Being Sent To Control =

PSS ID Number: 92382

Article Last Modified on 1/8/2003

-

The information in this article applies to:


 * Microsoft Visual Basic for MS-DOS 1.0

-



This article was previously published under Q92382



SYMPTOMS
When using an Access Key sequence to select a menu item, the current control on the form with the focus will receive a KeyUp event.



STATUS
Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The following steps will duplicate this problem:

 Start VBDOS.EXE. Form the File Menu select New Form... (Form1.FRM). Add a text box (Text1) to the Form (Form1). From the Window menu select the Menu Design Window... Create a top level menu, caption = &File, ctrlname = filem. Create a menu item within &File, caption = &Exit, ctrlname = exitm.</li> Close the Menu Design Windows.</li> From the File menu select Exit, save all changes.</li> Press F12.</li>  Add the following code to the Text1_KeyUp event procedure: SUB Text1_KeyUp (KeyCode AS INTEGER, Shift AS INTEGER) MSGBOX(STR$(KeyCode)) END SUB </li> Run the application (press F5).</li> Press ALT+F+X.</li></ol>

The message box appears with the ASCII code of the key pressed.

To work around this problem, trap for the KeyDown event. Note that with this problem the KeyDown event is not triggered, therefore if you trap for the KeyDown event you will know if it was an actual key pressed intended for that control, or if no KeyDown event was detected before the KeyUp event, you will know that it was the result of the menu Access Key selection.

Additional query words: VBmsdos Buglist1.00 1.00

Keywords: KB92382

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.