TIMER

WELL I WANT THAT IF I LOGIN AT 10:00:00 THEN AFTER 30 MIN IE 10:30:00 IT SHOULD GIVE ME A MSG BOX AND SAY 30 MIN

THEN AT 11:00:00 IT SHOULD SAY 60 MINUTES
IN SHORT I WANT THAT AFTER EVERY 30 MIN IT SHOULD GIVE ME A REMAINDER


THANKS SONAL
sonalchouhanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SLECommented:
Put a timer on your form and set its .Interval property to e.g. 60000 msec.


Private Sub Timer1_Timer()
    If Format(Time, "nn") = 30 Then
   
        MsgBox "Here comes your message..."
    End If
End Sub


Oh, pls don't shout...    ;-)
0
VbmasterCommented:
Put a timer on your form, set the Interval to 60000 (that's 1 min). And then put code like this into the Timer1_Interval event

Static Ticks As Integer
Ticks = Ticks + 1

If (Ticks = 30) Then
  Msgbox "You moron. 30 mins (again!)"
  Ticks = 0
End If

You can't set the timer interval to 60000 x 30 because the timer interval has a maximum value at aprox. 65000.
0
vikiingCommented:
A simple curiosity: ¿why people does not like to use IF's with the in-line fashion? Look:

    If Format(Time, "nn") = 30 Then
        MsgBox "Your message..."
    End If

¿Don't you find this way easier (and shorter)?:

 If Format(Time, "nn") = 30 Then MsgBox "Your message..."


Of course, not always that is possible (as when there are A LOT of commands to hang of a THEN branch), but I do each time I can. ¿Am I a dinosaur?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

SLECommented:
Writing complex if-then-else structures is more readable without the "in-line fashion look"...
0
mark2150Commented:
vikiing, I agree with you. I put single item if's on one line. To me it's shorter & cleaner.

It may also be *faster* (haven't checked so this isn't gospel) but in the "old" (pre-VB) days you could help the compiler to optimize the code by intelligent grouping. By putting the IF on one line the compiler knows that there is not going to be a long block of text or ELSE clauses and it may be able to optimize better than if it has to scan ahead looking for the rest of the statement.

M
0
vikiingCommented:
Why you've rejected SLE's answer?

That's the EXACT solution for you !!
0
eyaltilCommented:
Answer as above
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mark2150Commented:
Vikiing,

Actually SLE's answer is NOT a 100% "exact" solution. It will NOT give you an ELAPSED time indicator of 30 minutes unless you trigger it at the top of the hour. It's watching for the minutes to be = 30 and if you start the process at 31 past it'll not fire again for 59 minutes. This is fine if you are programming a cookoo clock and you want the noise to trigger on the 1/2 hour, but if you're wanting to chime after an *elapsed* 30 minutes, it doesn't work.

VbMaster's answer will fire the event 30 minutes after you start no matter what time you start at.

Being the lazy type the one change I would make to vbMaster's code is:

Ticks = ( Ticks + 1 ) mod 30

If (Ticks = 0) Then Msgbox "You moron. 30 mins (again!)"

This is shorter and automatically recycles the TICKS variable.

M

0
SLECommented:
mark2150 is right - stupid me    ;-)
0
mark2150Commented:
Also I don't see an *answer* posted by eyaltil! He's a *POINT GRABBER*!

sonalchouhan, be sure to REJECT eyaltil's non-answer and give the points to vbMaster!

M
0
vikiingCommented:
>>It will NOT give you an ELAPSED time indicator of 30 minutes

>>VbMaster's answer will fire the event 30 minutes after you start no matter

You're right; I've just noticed the difference.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.