1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Easy question

Discussion in 'Software Development' started by motocross95, Nov 29, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. motocross95

    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
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,189
    A loop in what context? In the context of a program looping a statement until the escape key is pressed?
     
  3. motocross95

    motocross95 Thread Starter

    Joined:
    Oct 30, 2001
    Messages:
    110
    yes loop a statement until the Esc key is pressed.
     
  4. owen68

    owen68

    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
     
  5. motocross95

    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
     
  6. TimCottee

    TimCottee

    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
     
  7. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/60108