Solved

.Net timer

Posted on 2013-06-11
3
368 Views
Last Modified: 2013-06-11
I have a timer on my page that is disabled and the interval on the timer is 1000

I assume that's milliseconds?

On a click event I want to

Timer1.Enabled = True
Timer1.start()

run for 15 seconds

Timer1.Stop
Timer1.Enabled = False
0
Comment
Question by:lrbrister
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39237877
add integer field in your class and set it to 0.
on the timer elapse event handler add 1 to the integer field each time.
also check if the field equals 15, if yes then stop the timer and set .Enabled = false, and reset the integer field to 0 again.
0
 
LVL 1

Accepted Solution

by:
OSUK earned 500 total points
ID: 39238271
My suggestion would be...

In the Click event put the code
Timer1.Interval = 15000  'yes the time is in milliseconds
Timer1.Start

Open in new window


In the Timer1_Tick event..
Timer1.stop
'Add whatever code you wish to process

Open in new window


If you can include a bit more detail of what you are trying to achieve with the timer i could provide more detail.
0
 

Author Closing Comment

by:lrbrister
ID: 39238298
THis had example code and  got me going.
Thanks...it's working

I have this
    Protected Sub lnkFrustrated_Click(sender As Object, e As EventArgs) Handles lnkFrustrated.Click
        tmrFrustrated.Interval = "19000"
        imgFrustrated.Visible = True
        tmrFrustrated.Enabled = True

    End Sub

    Private Sub tmrFrustrated_Tick(sender As Object, e As System.EventArgs) Handles tmrFrustrated.Tick
        tmrFrustrated.Enabled = False
        imgFrustrated.Visible = False
        lblImage.Text = "Have a nice day!"
    End Sub
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now