Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

.Net timer

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
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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.
ASKER CERTIFIED SOLUTION
Avatar of OSUK
OSUK
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

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