Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #2219
| From | Deanna Earley <dee@earlsoft.co.uk> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: Timers vb6 |
| Date | 2015-01-02 10:12 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <m85r1n$df7$1@speranza.aioe.org> (permalink) |
| References | <4360cb1a-4f7e-451a-9645-59b11166d1e9@googlegroups.com> <78240854-a5c0-46a1-a270-781aa97a26ec@googlegroups.com> |
On 31/12/2014 11:40, Andrew s wrote:
> On 31/12/2014 06:51, geomodelers@gmail.com wrote:> Dear All,
>> How to make a timer Unload Me/App until 30 minute from loaded App/form.
>
> SOLVED. Thanks
For anyone else that finds this, the easiest solution is to have a timer
fire every 30s (or any value up to but less than 60s) which then used
DateDiff() to calculate the time since it started (using a single Date
variable with "Now" assigned to it) and calling Unload Me if it's
greater than 30 minutes.
Private Started As Date
Private Sub Form_Load()
'Record the current time
Started = Now
End Sub
Private Sub ShutdownTimer_Timer()
'Check if the minute component has increased by 30
If DateDiff("n", Started, Now) > 30 Then Unload Me
End Sub
Note that this could be off by up to 1 minute either way due to the
frequency of the timer and the check not taking into account seconds.
To get around that, you can reduce the timer interval, and check the
number of seconds since it started in the timer.
--
Deanna Earley (dee@earlsoft.co.uk, dee@doesnotcompute.co.uk)
(Replies direct to my email address will be printed, shredded then fed
to the rats. Please reply to the group.)
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Find similar | Unroll thread
Timers vb6 geomodelers@gmail.com - 2014-12-30 22:51 -0800
Re: Timers vb6 Andrew s <geomodelers@gmail.com> - 2014-12-31 03:40 -0800
Re: Timers vb6 Deanna Earley <dee@earlsoft.co.uk> - 2015-01-02 10:12 +0000
csiph-web