Easy question

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

motocross95

Thread Starter
Joined
Oct 30, 2001
Messages
110
Someone should be able to help me on this one. I currently have a loop, how do I perform the loop until someone presses any key. Or better yet, perform it until someone presses ESC. Thank you
 
Joined
Jul 29, 2001
Messages
21,334
A loop in what context? In the context of a program looping a statement until the escape key is pressed?
 
Joined
Nov 19, 2001
Messages
10
It depends on the language your programming in but you need to use a Do While loop or the equilvalent.

Do (while test is False)

Whatever you want to do

Test

Loop
 

motocross95

Thread Starter
Joined
Oct 30, 2001
Messages
110
I'm sorry I forgot that. Visual Basic 6. I know the structure for it, but just can't figure out the command that would do it.

Do while (Command goes here) = false

Loop

or something that does the same thing. Thank you
 
Joined
Oct 10, 2001
Messages
186
Here is a simple example:

Private blnContinue As Boolean

Private Sub Command1_Click()
blnContinue = True
Do While blnContinue
Text1.Text = Now()
DoEvents
Loop
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
blnContinue = False
End If
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top