Using Context Menus for handling Shortcuts Keys

Category:
C#, VB.NET, ASP.NET
Type:
Classes
Difficulty:
Beginning
Author:
Tamas Balogh

Version Compatibility: Visual Basic.NET

More information:
Under VS 6 for the handling of shortcut keys the Form's KeyDown or KeyPress events was used, with the Form's KeyPreview property set to True. Under .NET Windows Forms this widely used solution does not always work. Some Controls swallow the events mentioned above so they never fire on the Form. As an alternative solution you can use Context Menus, to which you can assign Shortcut keys. This demo below shows how.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download shortcut.zip