|
-
Jun 12th, 2011, 12:31 PM
#1
Thread Starter
New Member
[RESOLVED] How to stop timer automatically
Hello Everyone,
I am developing a application in which i need your little help to complete...
i have listbox and have set timer for auto selecting...
i want to stop the timer after selection in liatbox reaches 10...or you can say that after running that timer 10 times....
and after 15 min i wanna that turn on automatically....
finally what i want is :
a timer stops for 15 minutes after running 10 times ..
little help would be appreciated..
thanks in advance.
-
Jun 12th, 2011, 09:54 PM
#2
Re: How to stop timer automatically
Stopping the timer after filling the listbox is easy ... you just monitor the count of items in the listbox in the timer code - when it reaches 10, you set the Timer's .Enabled property to false.
If you want it to turn on the timer after 15 minutes you'll need a 2nd timer that is enabled at the same time as you disable the first one.
When your form loads, set Timer1.Enabled = true, Timer2.Enabled = false. Then, when the code in timer1 determines the listbox is filled, disable Timer1, enable timer2. Timer2 should then count to 15 minutes (however you decide to handle that) then re-enable timer1 and disable itself after re-enabling timer1. Lather, rinse, repeat.
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
-
Jun 12th, 2011, 10:19 PM
#3
Thread Starter
New Member
Re: How to stop timer automatically
Hello sir,,,
i got it what u say.....but can u give me the code how to stop after 10 counts..plz..
thanks for ur reply
-
Jun 13th, 2011, 11:45 AM
#4
Re: How to stop timer automatically
 Originally Posted by Sumit4Work
Hello sir,,,
i got it what u say.....but can u give me the code how to stop after 10 counts..plz..
thanks for ur reply
Here's an alternate idea. Why don't you write some code (give it a try) then let us help you debug it. You won't learn anything if I just "give" you the code.
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
-
Jun 13th, 2011, 12:00 PM
#5
Re: How to stop timer automatically
Place a global variable and initialize it to 0. Everytime the TimerTick event is triggered increment your variable by one. Check to see if it reaches 10 and do what Max suggested then
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Jun 13th, 2011, 09:30 PM
#6
Thread Starter
New Member
Re: How to stop timer automatically
thanks max..i got it...
i made a label and counts the timer...and then use if label value is # then timer2.start and timer1.stop..
thank you very much sir...
-
Jun 14th, 2011, 08:11 PM
#7
Re: How to stop timer automatically
 Originally Posted by Sumit4Work
thanks max..i got it...
i made a label and counts the timer...and then use if label value is # then timer2.start and timer1.stop..
thank you very much sir...
That's the spirit. Glad you worked it out.
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|