Timer control in .Net / Silverlight
Hello,
So far, I've always programmed with Visual Basic, and at the time I get around to C #. My IDE is Microsoft Visual Studio 2008 and .NET Framework 3.5. Currently I have the big problem that I want to install a timer, but it does not currently, since no control can be found. Apparently that is so incorrect. So Google had engaged to find me a solution. When I thought it was useful was an error. Can you guys help me with this? Thank you.
Re: Timer control in .Net / Silverlight
Check out if this code can help you
Code:
private void Timer Tool ()
(
System.Timers.Timer tm = new Timer ();
tm.Interval = 1000;
tm.Elapsed + = new ElapsedEventHandler (tm_xp);
tm.Enabled = true;
tm.start ();
)
private void tm_xp ()
(
time + = 1;
label1.Content = time;
)
Re: Timer control in .Net / Silverlight
The "new ElapsedEventHandler," in line 5 is marked as an error. This message is recorded in the error-Windows .
Code:
No overload for 'timer_Elapsed agrees "with the delegates' System.Timers.ElapsedEventHandler match.
I'm still in it:
Can you help me with this?
Re: Timer control in .Net / Silverlight
Perhaps it would be better if timer from system.time namespace to not use the, but from the System.Windows.Forms and for the WPF Dispatcher-timer. (But I do not know because I work with WinForms from NET 2.0 only.)
Re: Timer control in .Net / Silverlight
I think you should include this part of the code
Code:
private void tm (Object snd, ElapsedEventArgs e)
(
time + = 1;
lb.Content = time;
)
Re: Timer control in .Net / Silverlight
It is now, but once a new problem or no problem but a question. But since it is topic-this, I do like a new thread. So thanks for the help it works now.