• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Is there any timer working with the GUI controls in C#?

Have a need to do this: the color in picture Box changes in two minutes. Is there any timer for the operation?
0
jl66
Asked:
jl66
  • 2
  • 2
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Yes...there is a Timer control in the Toolbox (the "Components" section by default).  Drop one on your form and set the Interval() property to 120,000.  Be sure to set the Enabled() property to true so it fires.  Now double click the "timer1" icon below your form to get the method stub (place your color changing code in there):
private void timer1_Tick(object sender, EventArgs e)
        {

        }

Open in new window

0
 
jl66Author Commented:
Thank you so much. If I want to do try-catch-finally, what kind of exceptions should I get for this timer?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I don't understand the question...if you have a Try/Catch then the exceptions would be caught by the Catch block.  The timer won't care.  =)
0
 
jl66Author Commented:
Thank you  so much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now