For example, you may want the key combination Ctrl+X to always perform the same action on a form. You can respond to specific keys pressed in the form, regardless of which control has the focus. ![]() With this property setting, all keyboard events occur first for the form, and then for the control that has the focus. A form can have the focus only if it has no controls or all its visible controls are disabled.Ī form will also receive all keyboard events, even those that occur for controls, if you set the KeyPreview property of the form to Yes. įor both events, the object with the focus receives all keystrokes. To run a macro or event procedure when these events occur, set the OnKeyUp property to the name of the macro or to. If you need to test for the Shift argument, you can use one of the following intrinsic constants as bit masks:ĪcShiftMask The bit mask for the Shift key.ĪcCtrlMask The bit mask for the Ctrl key. The state of the Shift, Ctrl, and Alt keys at the time of the event. You can prevent an object from receiving a keystroke by setting Ke圜ode to 0. ![]() To specify key codes, use the intrinsic constants shown in the Object Browser. Parameters NameĪ key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the Home key). SyntaxĮxpression A variable that represents a Form object. This event also occurs if you send a keystroke to a form or control by using the SendKeys action in a macro or the SendKeys statement in Visual Basic. The KeyUp event occurs when the user releases a key while a form or control has the focus.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |