Microsoft Visual Basic for .NET (VB.NET) programming language gives programmers the ability to control data input in the Windows Forms. By using VB.NET program controls you can capture any single keystroke or key combinations, including the "Ctrl" and "Alt" keys. The key combinations are available in addition to the Windows Forms standard keys, that are displayed as underscored letters in menus or menu items used with the "Alt" key. By using the key combinations in VB.NET programs you can create custom key shortcuts on the Windows Forms.
- Skill level:
Click "Start," "Microsoft Visual Basic for .NET."
Click "File," "Open." Double-click on the Visual Basic program in which you want to define a new key combination.
Enter the following code after the "public void DataGrid" line in the program:
Inherits DataGrid Protected Overrides Function ProcessCmdKey( _ ByRef msg As Message, _ ByVal key Data As Keys _ ) As Boolean End Function
MenuItem.ShortcutKeys = Keys.Control Or Keys.P
to define the "Ctrl+P" key combination on your Windows Forms.
Click "File," "Save" and "OK" to add the "Ctrl+P" key combination to your VB.NET program.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for