I am using (in VB6) the Timer1 function to read data in at 10 seconds interval. How do I continue to display the seconds in a text box before the 10 seconds interval is reached? Example:
1,2,3,4,5,6,7,8,9,10 --> collects data
11,12,13,14,15,16,17,18,19,20 --> collects data
21,22,23,24,25,26,27,28,29,30 --> collects data
and so on...
with each second being display in a text box as: Time Elapsed: x seconds (where x starts with 1).
thanks.
how to count seconds tick...
Page 1 of 12 Replies - 2812 Views - Last Post: 17 August 2010 - 11:41 AM
Replies To: how to count seconds tick...
#2
Re: how to count seconds tick...
Posted 17 August 2010 - 09:15 AM
Firstly, you need to be aware that the timer isn't 100% accurate, so as long as you're OK with that then you could try something as follows:
1. configure the timer interval to be 1 second and add a textbox to your form.
2. declare a module wide variable and set its value to one on start up and display it in your textbox.
3. In the timer event you could code it to check if you where at a 10 second interval by using the mod function. So something like:
4. Ensure you increment the variable and update the textbox in the timer event also.
Hopefully that should give you a starting point.
1. configure the timer interval to be 1 second and add a textbox to your form.
2. declare a module wide variable and set its value to one on start up and display it in your textbox.
3. In the timer event you could code it to check if you where at a 10 second interval by using the mod function. So something like:
if (variable mod 10) = 0) then
read data
endif
4. Ensure you increment the variable and update the textbox in the timer event also.
Hopefully that should give you a starting point.
#3
Re: how to count seconds tick...
Posted 17 August 2010 - 11:41 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|