|
-
Jan 13th, 2000, 04:01 AM
#1
Thread Starter
Member
I've currently have a loop of a ball bouncing around the screen, but i wanna know if thers any way u can get the loop to break if you hit escape or x. I tried to call form_keypress with in the loop to see if a key was pressed but that doesnt seem to be working. can anyone help?
-
Jan 13th, 2000, 04:25 AM
#2
Hyperactive Member
Hi,
This may work:
dim run as boolean
--------------------
do until run = false
' ball bouncing code
loop
Private Sub Form_KeyPress(KeyAscii As Integer)
dim strKey as string
strKey = chr(keyascii)
if strKey = "x" then run = false
End Sub
-------------------
I hope it works!
-
Jan 13th, 2000, 06:19 AM
#3
Hyperactive Member
-
Jan 13th, 2000, 06:37 AM
#4
Fanatic Member
Inorder for you to break a loop, you must use the function Doevents. Look this up in the help because that is the official method of breaking a loop.
-
Jan 13th, 2000, 07:39 AM
#5
Thread Starter
Member
Thank you for the help, The DoEvents worx great =)
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
|