473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Time and Loop Problem

553 512MB
How can i write a For Loop which will run until a user hits any key


Also , i want to do something like this :

Loop Until 'Anycondition'

Update time every second :
Now(Hour)
Now(Minute)
Now(Second)

Can anyone help
Jul 25 '07 #1
3 2211
Rabbit
12,516 Expert Mod 8TB
How can i write a For Loop which will run until a user hits any key


Also , i want to do something like this :

Loop Until 'Anycondition'

Update time every second :
Now(Hour)
Now(Minute)
Now(Second)

Can anyone help
You could try using DoEvents to throw control to the processor and process any keys using the KeyDown or KeyPress event.

As for the time there's a Timer event.
Jul 25 '07 #2
questionit
553 512MB
Rabbit

Can you give me any examples how to start?

Thanks

You could try using DoEvents to throw control to the processor and process any keys using the KeyDown or KeyPress event.

As for the time there's a Timer event.
Jul 25 '07 #3
Rabbit
12,516 Expert Mod 8TB
Here's a quick and dirty example, untested.

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim KeyPressed As Boolean
  3.  
  4. Private Sub Form_Load()
  5.    KeyPressed = False
  6. End Sub
  7.  
  8. Private Sub SomeControl_SomeEvent()
  9.   Do Until KeyPressed = True
  10.     ...
  11.     DoEvents
  12.   Loop
  13. End Sub
  14.  
  15. Private Sub Form_KeyDown(....)
  16.   KeyPressed = True
  17. End Sub
  18.  
Jul 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
3
by: Szabolcs Nagy | last post by:
I have to measure the time of a while loop, but with time.clock i always get 0.0s, although python manual sais: "this is the function to use for benchmarking Python or timing algorithms" So i...
5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
1
by: gi75research | last post by:
What should be a very simple function is going terribly wrong, and I don't know why. StartTime and EndTime are table values (formatted like "01:00A" or "02:00P"); DaypartStart and DaypartEnd are...
3
by: Servé Lau | last post by:
I encountered a situation today where time(NULL) returned -1. This was because at the point of the call the function could not read from the bus because it was locked by another process. I got the...
1
by: dk | last post by:
Any idea why the response time is slow when running a system tray app when viewing the properties form? There is one primary loop and a timer control which executes every 3minutes. Is having the...
6
by: eighthman11 | last post by:
Hi everyone: Using Sql Server SQL 8 I'm trying to INSERT records into a "can software package" batch table. I have a work-table that mimics the batch table. After manipulating the records in...
0
by: forgedascendant | last post by:
Good day everyone, I am new to this site so please forgive me if this post isn't completly correct. For the past 2 weeks I have been beating my head against the wall trying to figure out what is...
40
by: =?Utf-8?B?Um9iZXJ0IEUuIEZsYWhlcnR5?= | last post by:
What is the C# command to wait for a specified period of time? I am writing a windows service that will process a file once it has beed created or changed. I'm using the fileSystemWatcher to...
23
by: Bill Cunningham | last post by:
I have no idea what to do with time () or another function to change the time_t data type to int to get numbers say from 0-20 that are ints. time() reports a huge number of seconds and when using...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.