|
-
Feb 24th, 2010, 12:57 AM
#1
Thread Starter
New Member
Re: INKEY$ routine
 Originally Posted by ;19486
Why not using the form_keydown event.. eg.
Code:
Dim arrStations(3) As String
Private Sub Form_Load()
arrStations(0) = "Station 1"
arrStations(1) = "Station 2"
arrStations(2) = "Station 3"
arrStations(3) = "Station 4"
End Sub
Private Sub Form_KeyDown(KeyCode as Integer, Shift As Integer)
Static i As Integer
If KeyCode = The_Key_You_Want eg. vbKeySpace Then
lblStation.Caption = arrStations(i)
i = i + 1
If i > 3 Then
MsgBox "You've seen all stations."
Unload Me
End If
End If
End Sub
[This message has been edited by Crazy D (edited 02-07-2000).]
I have done quite a bit of research on this issue of a routine in VB that does what the Inkey$ function does in GWBasic. This is one of many example I found, however, it does not work on its own. Do I need to declare an API somewhere/somehow? Pease help as I am new at this. I WANT TO USE THIS VB CODE IN EXCEL.
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case ASC("a")
MsgBox ("a Key Pressed")
Case Else
MsgBox ("Key other than a Key Pressed")
End Select
End Sub
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
|