-
private
subtimer1_timer()
dimtimenow
asdate
timenow#pm#
print is still there at 4 p.m"
hour(timenow)
times"minute(timenow)
points"second(timenow)."iftime#
pm#then
msgbox
It's time"endifend
But you have to pay attention to one thing: subtract the time and you get the time difference, but when the time is now more than 4 p.m.
The time difference will increase by second, and before 4 o'clock it is a countdown of seconds by second.
Below I wrote about this program.
You'll understand a little bit better.
private
datnow
asdate,y
asinteger
private
subtimer1_timer()
datnow#
pm#nowy
val(year(now))
print distance.
June 6, 2012 at 7:30:50 p.m. And also. y year"month(datnow)
month"day(datnow)
days"hour(datnow)
hours"minute(datnow)
minutes"second(datnow)
seconds"end
sub is so accurate.,I hope to give a point o( o....
-
dim ltime as long 'The declared variable ltime is a long integer.
private sub form_load()ltime = 300 'Assign a value to the variable ltime.
1000 'Timer1 control's event interval (ms) end sub
private sub timer1_timer()ltime = ltime - 1 'The timer1 control is not run once, and the variable ltime is reduced by 1
" + str(int(ltime / 60)) ":" + str(ltime - int(ltime / 60) *60)
The variable ltime is converted to the form of "minutes:seconds" and displayed by label1.
if ltime = 0 then 'If the variable ltime becomes 0msgbox"The time has come! " 'A pop-up window says it's time.
false 'Stop timer1
end if
end sub
-
<>dim i as integer
private sub command1 click() timer to start working).
The countdown has started and this button cannot be clicked again.
true 'start the timer.
1000' refresh the interface every second.
i=60 'The time you want to count down to 60 seconds, in this case, is assumed to be 60 seconds, which you can actually change.
end sub
private sub timer1 timer()i = i-1 'decrement.
if i > 0 then
Remaining"&i & s"
It's time"Stop the timer.
'true' button is available.
end if
end sub
-
About (question being answered).
This solution is a humiliation of the timer control and a lack of learning. If the countdown time is more than 5 seconds, it will be while....Wend's loop design is not enough, if you use his function to count down for 10 minutes, you can't jump out of the loop action for 10 minutes, let alone continue to start the second countdown and the third countdown.
I won't talk about the principle, just tell you the key points of the design.
It is correct to use multiple timer controls to handle multiple countdowns, with countdowns of 600 seconds, 480 seconds, and 360 seconds as explanations, to accurately timer is not to subtract 1 or subtract each time in the timer control, which does not mean that the time is close to 1 second or 1 millisecond. Rather, think of the event as "the frequency rate of the number of times the check is made", such as:
The future time to get the countdown Present time + 600 seconds = future time.
The interval of the timer event is set to 100 ms (the error value of the system is more than 7-15 ms because the entire resource is busy).
Each timer event checks whether the variable in the future time is due to the current computer time, rather than checking from 600-i each time to see if it is 0
If this method will have an error of more than 200 milliseconds, then I will tell you the reason, this error is a quality problem of the crystal frequency system of the computer motherboard. The quality of the server's motherboard crystal frequency system may also deviate from the standard time by a few seconds per day.
Note the principle that the first 599 seconds can be 500 milliseconds each time because the system is busy, but the error between the last decisive 1 second expiration time and the system time will never exceed 200 milliseconds, which is twice as much as interval=100ms.
If you're interested, try using a do....loop or while....The WEND cycle checks whether the 600 seconds expire, even if you add doevents and sleep, it not only takes up about 30% of the system resources and slows down the system speed, but also makes other controls of its own program, and other events of the ** have no chance to run.
Try using 10 timer controls at the same time, and you'll see that the 10 countdown controls take up less than 10% of the system's resources
I once saw that the xx propaganda function can be set to automatically click the mouse every 1 millisecond, and I laughed, regardless of whether it is a supercomputer or not, it takes more than 50 milliseconds to complete the exchange of mouse click information with the remote server.
If you have any questions about this content, please continue to ask questions, and I will continue to reply to them when I have time.
Upstairs ** is so long, it's still simple?
Speechless. I wrote one for you, this is really simple and practical, hehe! >>>More
This can't be turned off, this function of the Xiaomi system is mandatory. >>>More
Summary. Dear hello, I am very happy to serve you, the World Cup will end in about 28 days, and the World Cup will end from November 21st to December 18th. It lasted 28 days. >>>More
Asa can't be the boss of the dark organization, because he usually knows what Conan does, and the dark organization has failed in many episodes, and it is impossible for Asa to know Conan's plan and not tell Gin about them, and, although Aoyama said that the dark organization boss in the ending will be beyond everyone's expectations, I don't think it can be a doctor. After ten years of filming, Ah Li's ** is the same as reality, just a ridiculous behavior of the author. >>>More
In fact, I have thought about this question countless times, and my teacher once asked this question when I was in a social psychology class, and since I have seriously considered it, I am willing to share my thoughts with everyone. >>>More