Noname > 28-08-10, 11:01 AM
'Đoạn code này sẽ liệt kê mã của các ký tự trên bàn phím
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 255
List1.AddItem i & vbTab & Chr(i)
Next
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case (KeyCode)
Case "8"
MsgBox "Backspace Keyis " & KeyCode
Case "9"
MsgBox "Tap Key is " & KeyCode
Case "12"
MsgBox "Clear Key is " & KeyCode
Case "13"
MsgBox "Enter Key is " & KeyCode
Case "16"
MsgBox "Shift Key is " & KeyCode
Case "17"
MsgBox "Control Key is " & KeyCode
Case "27"
MsgBox "Esc Key is " & KeyCode
Case "32"
MsgBox "SpaceBar Key is " & KeyCode
Case "112"
MsgBox "F1 Key is " & KeyCode
Case "113"
MsgBox "F2 Key is " & KeyCode
Case "114"
MsgBox "F3 Key is " & KeyCode
Case "115"
MsgBox "F4 Key is " & KeyCode
Case "116"
MsgBox "F5 Key is " & KeyCode
Case "117"
MsgBox "F6 Key is " & KeyCode
Case "118"
MsgBox "F7 Key is " & KeyCode
Case "119"
MsgBox "F8 Key is " & KeyCode
Case "120"
MsgBox "F9 Key is " & KeyCode
Case "121"
MsgBox "F10 Key is " & KeyCode
Case "122"
MsgBox "F11 Key is " & KeyCode
Case "123"
MsgBox "F12 Key is " & KeyCode
Case Else
MsgBox "you is press " & KeyCode
End Select
End Sub