?
Solved

.Net timer

Posted on 2013-06-11
3
Medium Priority
?
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

771 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