Microsoft KB Archive/92382
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
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.
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.
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.
- Close the Menu Design Windows.
- From the File menu select Exit, save all changes.
- Press F12.
Add the following code to the Text1_KeyUp event procedure:
SUB Text1_KeyUp (KeyCode AS INTEGER, Shift AS INTEGER) MSGBOX(STR$(KeyCode)) END SUB
- Run the application (press F5).
- Press ALT+F+X.
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
Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3