|
-
Feb 6th, 2000, 02:06 AM
#1
Thread Starter
New Member
In QBASIC, I can use the code:
while inkey$="":wend
to pause the program and let me press a key to continue.
Visual BASIC doesn't have the INKEY$ keyword. How can I simulate INKEY$ in Visual BASIC?
-
Feb 6th, 2000, 05:44 AM
#2
Addicted Member
While Getasynckeystate(keycode)<> 0
Dosomething
Wend
GetAsyncKeystate is a api so don't forget to declare it.
keycode must be the key in ASCII
------------------
Razzle
ICQ#: 31429438
-
Feb 6th, 2000, 10:50 AM
#3
Thread Starter
New Member
Originally posted by Razzle:
While Getasynckeystate(keycode)<> 0
Dosomething
Wend
GetAsyncKeystate is a api so don't forget to declare it.
keycode must be the key in ASCII
I want the Visual BASIC program to work like this:
start of subway route
print name of first subway station
wait for keypress
print name of next subway station
wait for keypress
print name of next subway station
wait for keypress
print name of next subway station
wait for keypress
print name of next subway station
wait for keypress
until end of route
-
Feb 6th, 2000, 02:59 PM
#4
Hyperactive Member
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).]
-
Feb 7th, 2000, 06:13 AM
#5
Thread Starter
New Member
Originally posted by Crazy D:
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).]
Crazy D, Putting station names in string array and using a variable to keep track of which station should work but what if I make a mistake while writing the program and I have to fix it? What about creating an array containing station names and type of station such as local, express and terminal station? Jeffrey.
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
|