-
KeyDown Event
Hi, I am writing a program using the keydown event. It works great except I can not get it to send the number keys and other keys like, space, enter, shift, etc. to my text file? Why, would it send letters and not numbers. An example of my code follows:
Code:
Private Sub Form_KeyDown(keycode As Integer, Shift As Integer)
If keycode = 54 Then
Dim ggFile As Integer
ggFile = FreeFile
Open "C:\Log.txt" For Append As ggFile
Print #ggFile, "6";
Close ggFile
End If
Also, When I make the program Invisible it will not send any keys to the file.
Thanks,
Kevin
Edited by kevdog on 02-27-2000 at 02:02 AM
-
To send the all the number keys this is what I do:
Private Sub Form_KeyDown(keycode As Integer, Shift As Integer)
Dim strChr as String
strChr = KeyAscii
If strChr => 0 and strChr <= 9 then
'Dosomething
endif
end sub
-
It won't work for me, it give me a runtime error 13. This is my current code, Please Help.
Code:
Private Sub Form_KeyDown(keycode As Integer, Shift As Integer)
Dim strChr As String
strChr = KeyAscii
If strChr >= 0 And strChr <= 9 Then
Open "C:\Log.txt" For Append As strChr
Print #strChr, ;
Close strChr
End If
End Sub
Thanks,
Kevin
-