|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to call an event when the "Delete" button is pressed?Dear ALl,
I want to call an event when the user click on the "Delete" button (below the "Insert" button) of the keyboard while working on the Form1. How can I do that? Thank you in advance for any comments. DORI "DORI" <D***@discussions.microsoft.com> wrote in message Have a look at Form_KeyPress or Form_KeyDown. You can select them from the news:C5D46316-2BF5-412E-BD8D-2587ABE6FCF7@microsoft.com... > Dear ALl, > I want to call an event when the user click on the "Delete" button (below > the "Insert" button) of the keyboard while working on the Form1. How can I > do > that? > Thank you in advance for any comments. > DORI combobox at the top right of the code window. Select "Form" in the top left combo. "DORI" <D***@discussions.microsoft.com> wrote Set the form's KeyPreview property to True. It will then get the keyboard> Dear ALl, > I want to call an event when the user click on the "Delete" button (below > the "Insert" button) of the keyboard while working on the Form1. How can I do > that? events before any of the controls. To watch for the Delete key, test for it in the form's KeyDown or KeyUp event. If you want to stop further processing (not pass the key on to the active control) set the KeyCode value to 0, otherwise leave it alone for the active control (editing a textbox perhaps?) to respond as normal... HTH LFS Dear Larry,
Thank you so much for your help. I was not changing the form's keypreview property to True. After I followed your directions, it worked perfect. Thanks again, DORI Show quote "Larry Serflaten" wrote: > > "DORI" <D***@discussions.microsoft.com> wrote > > Dear ALl, > > I want to call an event when the user click on the "Delete" button (below > > the "Insert" button) of the keyboard while working on the Form1. How can I do > > that? > > Set the form's KeyPreview property to True. It will then get the keyboard > events before any of the controls. To watch for the Delete key, test for it > in the form's KeyDown or KeyUp event. If you want to stop further processing > (not pass the key on to the active control) set the KeyCode value to 0, otherwise > leave it alone for the active control (editing a textbox perhaps?) to respond > as normal... > > HTH > LFS > > > |
|||||||||||||||||||||||