469,282 Members | 2,034 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Tmer

How do I get this to work?
Libraries to use etc.?
Thanks,
Patrick.

Timer timer = new Timer()
timer.Interval = 1000; // Once a second
timer.Tick += new EventHandler(OnTick);
timer.Enabled = true;
timer.Start();

protected void OnTick(object s, EventArgs ea)
{
MessageBox.Show("Tick Interval");
}
Nov 13 '05 #1
6 3771
What is your problem? If one doesn´t know the problem it cannot be solved :)
Perhaps you just forget the ';' after Timer timer = new Timer() ;-)
Greetings, timtos.

"Patrick De Ridder" <no****@all.eu> wrote in message
news:10***************@evisp-news-01.ops.asmr-01.energis-idc.net...
How do I get this to work?
Libraries to use etc.?
Thanks,
Patrick.

Timer timer = new Timer()
timer.Interval = 1000; // Once a second
timer.Tick += new EventHandler(OnTick);
timer.Enabled = true;
timer.Start();

protected void OnTick(object s, EventArgs ea)
{
MessageBox.Show("Tick Interval");
}

Nov 13 '05 #2
Hi,

He is using System.Windows.Forms.Timer

System.Timers.Timer use the event Epalsed whether the one in Forms use Tick

The different according to MSDN is that the one in Windows.Form is
optimized for use in windows forms application.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Chris Hornberger" <ch***@chornbe.com> wrote in message
news:53*************************@posting.google.co m...
I only use the timers in System.Timers;

using System.Timers;

or

System.Timers.Timer timer = new System.Timers.Timer();
then the rest of your code from there.
How do I get this to work?
Libraries to use etc.?
Thanks,
Patrick.

Timer timer = new Timer()
timer.Interval = 1000; // Once a second
timer.Tick += new EventHandler(OnTick);
timer.Enabled = true;
timer.Start();

protected void OnTick(object s, EventArgs ea)
{
MessageBox.Show("Tick Interval");
}

Nov 13 '05 #3
Not only.

System.Windows.Forms.Timer doesn't work when there is no form, e.g. in
Windows service.

Eliyahu

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi,

He is using System.Windows.Forms.Timer

System.Timers.Timer use the event Epalsed whether the one in Forms use Tick
The different according to MSDN is that the one in Windows.Form is
optimized for use in windows forms application.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Chris Hornberger" <ch***@chornbe.com> wrote in message
news:53*************************@posting.google.co m...
I only use the timers in System.Timers;

using System.Timers;

or

System.Timers.Timer timer = new System.Timers.Timer();
then the rest of your code from there.
> How do I get this to work?
> Libraries to use etc.?
> Thanks,
> Patrick.
>
> Timer timer = new Timer()
> timer.Interval = 1000; // Once a second
> timer.Tick += new EventHandler(OnTick);
> timer.Enabled = true;
> timer.Start();
>
> protected void OnTick(object s, EventArgs ea)
> {
> MessageBox.Show("Tick Interval");
> }
>
>


Nov 13 '05 #4

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
System.Timers.Timer use the event Epalsed whether the one in Forms

use Tick
^^^^^^^^
wow, I've been doing this for a while now, but I've never come across
that "Epalsed" event. What raises it?

he he,
Scott
Nov 13 '05 #5
Hi Scott,

Too much Coffe I think ;) It makes you mix your ginfers :D

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Scott" <sc*****@thegapJUNKcompany.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
System.Timers.Timer use the event Epalsed whether the one in Forms

use Tick
^^^^^^^^
wow, I've been doing this for a while now, but I've never come across
that "Epalsed" event. What raises it?

he he,
Scott

Nov 13 '05 #6

"Scott" <sc*****@thegapJUNKcompany.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
System.Timers.Timer use the event Epalsed whether the one in Forms

use Tick
^^^^^^^^
wow, I've been doing this for a while now, but I've never come across
that "Epalsed" event. What raises it?

he he,
Scott


Epalsed (elapsed?) whether (whereas?)
This looks like mistakes made by a dyslectic.
You owe Ignacio Machin an apology.

Patrick.

Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.