|
-
Jul 9th, 2010, 03:11 AM
#4
Re: Is there a way to have a label to show the name for the key that is pressed?
This will get you started:
Code:
Option Explicit
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 13: Label1.Caption = "Enter key"
Case 8: Label1.Caption = "Backspace"
Case 27: Label1.Caption = "Escape"
Case 32: Label1.Caption = "Space bar"
Case 46: Label1.Caption = "Delete"
Case 65 To 90, 97 To 122: Label1.Caption = UCase$(Chr$(KeyCode)) '~~~ A to Z
Case 48 To 57: Label1.Caption = CStr(KeyCode - 48) '~~~ 0 to 9
Case Else: Label1.Caption = "Write the code for this !!! ;-)"
End Select
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
Add a labelbox to your form and run the code...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|