473,609 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timer and refreshing the UI

I'm trying to set a timer that gets called every 3 seconds so I can update a
field in the UI with the time elapsed since the process started.

What am I doing wrong that timerDF_Tick does not get called?

private System.Windows. Forms.Timer timerDF;
this.timerDF = new System.Windows. Forms.Timer(thi s.components);

this.timerDF.In terval = 3000;
this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);

timerDF.Enabled = true;
timerDF.Start() ;
// here I call a stored procedure that takes about 10 minutes to run
......

private void timerDF_Tick(ob ject sender, System.EventArg s e)
{
DateTime dt2 = DateTime.Now;
TimeSpan diff = dt2 - dt1 ;

textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
diff.Hours.ToSt ring("00"),
diff.Minutes.To String("00"),
diff.Seconds.To String("00") );

textProcessTime .Update();

this.Update();
}
Nov 16 '05 #1
8 2772
Where are you putting the this.timerDF.Ti ck += new
System.EventHan dler(this.timer DF_Tick) statement? I would put it in your
Load event, or somewhere near the init of the win form.

But, It doesn't look like you are doing anything wrong (although I would use
System.Timers.T imer as opposed to System.Windows. Forms.Timer). Also, you
shouldn't need to call textProcessTime .Update() or this.Update().

Have you tried placing a breakpoint in the timerDF_Tick event to see if it
is not firing?

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
| I'm trying to set a timer that gets called every 3 seconds so I can update
a
| field in the UI with the time elapsed since the process started.
|
| What am I doing wrong that timerDF_Tick does not get called?
|
|
|
| private System.Windows. Forms.Timer timerDF;
| this.timerDF = new System.Windows. Forms.Timer(thi s.components);
|
| this.timerDF.In terval = 3000;
| this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);
|
| timerDF.Enabled = true;
| timerDF.Start() ;
|
|
| // here I call a stored procedure that takes about 10 minutes to run
| .....
|
| private void timerDF_Tick(ob ject sender, System.EventArg s e)
| {
| DateTime dt2 = DateTime.Now;
| TimeSpan diff = dt2 - dt1 ;
|
| textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
| diff.Hours.ToSt ring("00"),
| diff.Minutes.To String("00"),
| diff.Seconds.To String("00") );
|
| textProcessTime .Update();
|
| this.Update();
| }
|
|
Nov 16 '05 #2

"Kyril Magnos" <ky**********@y ahoo.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Where are you putting the this.timerDF.Ti ck += new
System.EventHan dler(this.timer DF_Tick) statement? I would put it in your
Load event, or somewhere near the init of the win form.
It's in InitializeCompo nent.
But, It doesn't look like you are doing anything wrong (although I would use System.Timers.T imer as opposed to System.Windows. Forms.Timer). Also, you
shouldn't need to call textProcessTime .Update() or this.Update().

Have you tried placing a breakpoint in the timerDF_Tick event to see if it
is not firing?
I did put a breakpoing and it is not firing.

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
| I'm trying to set a timer that gets called every 3 seconds so I can update a
| field in the UI with the time elapsed since the process started.
|
| What am I doing wrong that timerDF_Tick does not get called?
|
|
|
| private System.Windows. Forms.Timer timerDF;
| this.timerDF = new System.Windows. Forms.Timer(thi s.components);
|
| this.timerDF.In terval = 3000;
| this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);
|
| timerDF.Enabled = true;
| timerDF.Start() ;
|
|
| // here I call a stored procedure that takes about 10 minutes to run
| .....
|
| private void timerDF_Tick(ob ject sender, System.EventArg s e)
| {
| DateTime dt2 = DateTime.Now;
| TimeSpan diff = dt2 - dt1 ;
|
| textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
| diff.Hours.ToSt ring("00"),
| diff.Minutes.To String("00"),
| diff.Seconds.To String("00") );
|
| textProcessTime .Update();
|
| this.Update();
| }
|
|

Nov 16 '05 #3
Hi,
inline

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started.

What am I doing wrong that timerDF_Tick does not get called?


The timer event can only fire if the message loop is running and it's
blocked because the 10minute during sp is executed inside an event handler
(or inside a function that's called from an event handler).

There are other timers that can fire while the message loop is blocked, but
it won't do you any good because then you would have to marshal from a
system thread to the UI thread, which also doesn't work when the message
loop is blocked.

What you need to do : call this 10minute stored procedure from a
workerthread. Then the message-loop won't be blocked and timer event's will
fire.

eg:

public void SomeMethod()
{ private System.Windows. Forms.Timer timerDF;
this.timerDF = new System.Windows. Forms.Timer(thi s.components);

this.timerDF.In terval = 3000;
this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);

timerDF.Enabled = true;
timerDF.Start() ;
Thread tr = new Thread(new ThreadStart(Run SP));
tr.Start();
}

public void RunSP()
{
// here you should call a stored procedure that takes about 10
minutes to run,
// so it doesn't block the UI thread (message loop)
}
HTH,
greetings

private void timerDF_Tick(ob ject sender, System.EventArg s e)
{
DateTime dt2 = DateTime.Now;
TimeSpan diff = dt2 - dt1 ;

textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
diff.Hours.ToSt ring("00"),
diff.Minutes.To String("00"),
diff.Seconds.To String("00") );

textProcessTime .Update();

this.Update();
}

Nov 16 '05 #4
Thanks! That did it. The worker thread is doing its job while the main
thread displays the updated timer.
Is there a more efficient way to wait for the worker thread then using Sleep
as below?
I was thinking to use a callback to the main thread but that creates strong
coupling.

Thread t = new Thread(new ThreadStart( myObj.ThreadPro c ) );
t.Start();

while( true == t.IsAlive )
{
Thread.Sleep(10 00);
UpdateTimeElaps ed();
}
"BMermuys" <so*****@someon e.com> wrote in message
news:29******** *************** @phobos.telenet-ops.be...
Hi,
inline

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
I'm trying to set a timer that gets called every 3 seconds so I can
update a
field in the UI with the time elapsed since the process started.

What am I doing wrong that timerDF_Tick does not get called?
The timer event can only fire if the message loop is running and it's
blocked because the 10minute during sp is executed inside an event handler
(or inside a function that's called from an event handler).

There are other timers that can fire while the message loop is blocked,

but it won't do you any good because then you would have to marshal from a
system thread to the UI thread, which also doesn't work when the message
loop is blocked.

What you need to do : call this 10minute stored procedure from a
workerthread. Then the message-loop won't be blocked and timer event's will fire.

eg:

public void SomeMethod()
{
private System.Windows. Forms.Timer timerDF;
this.timerDF = new System.Windows. Forms.Timer(thi s.components);

this.timerDF.In terval = 3000;
this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);

timerDF.Enabled = true;
timerDF.Start() ;

Thread tr = new Thread(new ThreadStart(Run SP));
tr.Start();
}

public void RunSP()
{
// here you should call a stored procedure that takes about 10
minutes to run,
// so it doesn't block the UI thread (message loop)
}
HTH,
greetings

private void timerDF_Tick(ob ject sender, System.EventArg s e)
{
DateTime dt2 = DateTime.Now;
TimeSpan diff = dt2 - dt1 ;

textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
diff.Hours.ToSt ring("00"),
diff.Minutes.To String("00"),
diff.Seconds.To String("00") );

textProcessTime .Update();

this.Update();
}


Nov 16 '05 #5

"Daniel P." <da******@hotma il.comU> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
Thanks! That did it. The worker thread is doing its job while the main
thread displays the updated timer.
Is there a more efficient way to wait for the worker thread then using Sleep as below?
I was thinking to use a callback to the main thread but that creates strong coupling.

Thread t = new Thread(new ThreadStart( myObj.ThreadPro c ) );
t.Start();

while( true == t.IsAlive )
{
Thread.Sleep(10 00);
UpdateTimeElaps ed();
}

If you wait for the thread to end, then you don't gain much by using a
worker thread. You're are still blocking the message loop this way,
remember that's it's no good to do lenghty operations inside eventhandlers,
they make the UI non-responsive.

Start the timer and thread, don't wait for the thread to end, but let the
thread fire an event when it's done, and from that event you could stop the
timer.
HTH,
greetings

"BMermuys" <so*****@someon e.com> wrote in message
news:29******** *************** @phobos.telenet-ops.be...
Hi,
inline

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
I'm trying to set a timer that gets called every 3 seconds so I can update
a
field in the UI with the time elapsed since the process started.

What am I doing wrong that timerDF_Tick does not get called?


The timer event can only fire if the message loop is running and it's
blocked because the 10minute during sp is executed inside an event

handler (or inside a function that's called from an event handler).

There are other timers that can fire while the message loop is blocked,

but
it won't do you any good because then you would have to marshal from a
system thread to the UI thread, which also doesn't work when the message
loop is blocked.

What you need to do : call this 10minute stored procedure from a
workerthread. Then the message-loop won't be blocked and timer event's

will
fire.

eg:

public void SomeMethod()
{
private System.Windows. Forms.Timer timerDF;
this.timerDF = new System.Windows. Forms.Timer(thi s.components);

this.timerDF.In terval = 3000;
this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);

timerDF.Enabled = true;
timerDF.Start() ;

Thread tr = new Thread(new ThreadStart(Run SP));
tr.Start();
}

public void RunSP()
{
// here you should call a stored procedure that takes about 10
minutes to run,
// so it doesn't block the UI thread (message loop)
}
HTH,
greetings

private void timerDF_Tick(ob ject sender, System.EventArg s e)
{
DateTime dt2 = DateTime.Now;
TimeSpan diff = dt2 - dt1 ;

textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
diff.Hours.ToSt ring("00"),
diff.Minutes.To String("00"),
diff.Seconds.To String("00") );

textProcessTime .Update();

this.Update();
}



Nov 16 '05 #6
A while loop with a Sleep seems to work fine.

If I use an event and the ClickButton method ends after starting the thread
then how can I keep the UI disabled so the user cannot click the button
again or launch other reports?
"BMermuys" <so*****@someon e.com> wrote in message
news:QS******** *************** @phobos.telenet-ops.be...

"Daniel P." <da******@hotma il.comU> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
Thanks! That did it. The worker thread is doing its job while the main
thread displays the updated timer.
Is there a more efficient way to wait for the worker thread then using Sleep
as below?
I was thinking to use a callback to the main thread but that creates

strong
coupling.

Thread t = new Thread(new ThreadStart( myObj.ThreadPro c ) );
t.Start();

while( true == t.IsAlive )
{
Thread.Sleep(10 00);
UpdateTimeElaps ed();
}


If you wait for the thread to end, then you don't gain much by using a
worker thread. You're are still blocking the message loop this way,
remember that's it's no good to do lenghty operations inside

eventhandlers, they make the UI non-responsive.

Start the timer and thread, don't wait for the thread to end, but let the
thread fire an event when it's done, and from that event you could stop the timer.
HTH,
greetings

"BMermuys" <so*****@someon e.com> wrote in message
news:29******** *************** @phobos.telenet-ops.be...
Hi,
inline

"Daniel P." <da******@hotma il.comU> wrote in message
news:u8******** ******@TK2MSFTN GP12.phx.gbl...
> I'm trying to set a timer that gets called every 3 seconds so I can

update
a
> field in the UI with the time elapsed since the process started.
>
> What am I doing wrong that timerDF_Tick does not get called?
>
>

The timer event can only fire if the message loop is running and it's
blocked because the 10minute during sp is executed inside an event handler (or inside a function that's called from an event handler).

There are other timers that can fire while the message loop is blocked,
but
it won't do you any good because then you would have to marshal from a
system thread to the UI thread, which also doesn't work when the
message loop is blocked.

What you need to do : call this 10minute stored procedure from a
workerthread. Then the message-loop won't be blocked and timer event's will
fire.

eg:

public void SomeMethod()
{
> private System.Windows. Forms.Timer timerDF;
> this.timerDF = new System.Windows. Forms.Timer(thi s.components);
>
> this.timerDF.In terval = 3000;
> this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);
>
> timerDF.Enabled = true;
> timerDF.Start() ;
>
Thread tr = new Thread(new ThreadStart(Run SP));
tr.Start();
}

public void RunSP()
{
// here you should call a stored procedure that takes about

10 minutes to run,
// so it doesn't block the UI thread (message loop)
}
HTH,
greetings
> private void timerDF_Tick(ob ject sender, System.EventArg s e)
> {
> DateTime dt2 = DateTime.Now;
> TimeSpan diff = dt2 - dt1 ;
>
> textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
> diff.Hours.ToSt ring("00"),
> diff.Minutes.To String("00"),
> diff.Seconds.To String("00") );
>
> textProcessTime .Update();
>
> this.Update();
> }
>
>



Nov 16 '05 #7
Hi,

"Daniel P." <da******@hotma il.comU> wrote in message
news:Os******** *******@TK2MSFT NGP10.phx.gbl.. .
A while loop with a Sleep seems to work fine.
Can you minimize, maximize or move your form ?

If I use an event and the ClickButton method ends after starting the thread then how can I keep the UI disabled so the user cannot click the button
again or launch other reports?
Sure, using threads may cause re-entrance problems, but that's easely
solved. Disable the button after the user presses it:
command1.Enable d = false;

Then re-enable it after the finish-event fired:
command1.Enable d = true;

I know threads can cause new problems but you should really not make long
loops in UI-event-handlers. There is always one thread (the main thread)
and for windows applications also called the UI thread. This thread does
nothing else then asking the OS if there is a message (mouse_click,
key_pressed, etc) and then runs the appropriote event (this event loop is
inside Application.Run ). So only one event can happen at any time. If you
do lenghty operations inside an event, no other events have a chance to
fire, you block the UI.

HTH,
greetings


"BMermuys" <so*****@someon e.com> wrote in message
news:QS******** *************** @phobos.telenet-ops.be...

"Daniel P." <da******@hotma il.comU> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
Thanks! That did it. The worker thread is doing its job while the main
thread displays the updated timer.
Is there a more efficient way to wait for the worker thread then using

Sleep
as below?
I was thinking to use a callback to the main thread but that creates

strong
coupling.

Thread t = new Thread(new ThreadStart( myObj.ThreadPro c ) );
t.Start();

while( true == t.IsAlive )
{
Thread.Sleep(10 00);
UpdateTimeElaps ed();
}


If you wait for the thread to end, then you don't gain much by using a
worker thread. You're are still blocking the message loop this way,
remember that's it's no good to do lenghty operations inside

eventhandlers,
they make the UI non-responsive.

Start the timer and thread, don't wait for the thread to end, but let the
thread fire an event when it's done, and from that event you could stop

the
timer.
HTH,
greetings

"BMermuys" <so*****@someon e.com> wrote in message
news:29******** *************** @phobos.telenet-ops.be...
> Hi,
> inline
>
> "Daniel P." <da******@hotma il.comU> wrote in message
> news:u8******** ******@TK2MSFTN GP12.phx.gbl...
> > I'm trying to set a timer that gets called every 3 seconds so I can update
> a
> > field in the UI with the time elapsed since the process started.
> >
> > What am I doing wrong that timerDF_Tick does not get called?
> >
> >
>
> The timer event can only fire if the message loop is running and it's > blocked because the 10minute during sp is executed inside an event

handler
> (or inside a function that's called from an event handler).
>
> There are other timers that can fire while the message loop is

blocked, but
> it won't do you any good because then you would have to marshal from a > system thread to the UI thread, which also doesn't work when the message > loop is blocked.
>
> What you need to do : call this 10minute stored procedure from a
> workerthread. Then the message-loop won't be blocked and timer event's will
> fire.
>
> eg:
>
> public void SomeMethod()
> {
> > private System.Windows. Forms.Timer timerDF;
> > this.timerDF = new System.Windows. Forms.Timer(thi s.components);
> >
> > this.timerDF.In terval = 3000;
> > this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);
> >
> > timerDF.Enabled = true;
> > timerDF.Start() ;
> >
> Thread tr = new Thread(new ThreadStart(Run SP));
> tr.Start();
> }
>
> public void RunSP()
> {
> // here you should call a stored procedure that takes about 10 > minutes to run,
> // so it doesn't block the UI thread (message loop)
> }
>
>
> HTH,
> greetings
>
>
> > private void timerDF_Tick(ob ject sender, System.EventArg s e)
> > {
> > DateTime dt2 = DateTime.Now;
> > TimeSpan diff = dt2 - dt1 ;
> >
> > textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
> > diff.Hours.ToSt ring("00"),
> > diff.Minutes.To String("00"),
> > diff.Seconds.To String("00") );
> >
> > textProcessTime .Update();
> >
> > this.Update();
> > }
> >
> >
>
>



Nov 16 '05 #8
"BMermuys" <so*****@someon e.com> wrote in message
news:GW******** *************** @phobos.telenet-ops.be...
Hi,

"Daniel P." <da******@hotma il.comU> wrote in message
news:Os******** *******@TK2MSFT NGP10.phx.gbl.. .
A while loop with a Sleep seems to work fine.
Can you minimize, maximize or move your form ?


No, but it does not look like an issue for the user.
If I use an event and the ClickButton method ends after starting the

thread
then how can I keep the UI disabled so the user cannot click the button
again or launch other reports?


Sure, using threads may cause re-entrance problems, but that's easely
solved. Disable the button after the user presses it:
command1.Enable d = false;

Then re-enable it after the finish-event fired:
command1.Enable d = true;


Yes, I was thinking to do that but the user can close the Form or close the
app or launch another report, etc and this is not good.
I know threads can cause new problems but you should really not make long
loops in UI-event-handlers. There is always one thread (the main thread)
and for windows applications also called the UI thread. This thread does
nothing else then asking the OS if there is a message (mouse_click,
key_pressed, etc) and then runs the appropriote event (this event loop is
inside Application.Run ). So only one event can happen at any time. If you do lenghty operations inside an event, no other events have a chance to
fire, you block the UI.
The while loop with a Sleep does not seem to take a lot of CPU, the worker
thread does its job fine and for the time being I'll leave it the way it is
but I am still interested in a better solution for a future release.
HTH,
greetings
Thanks!!!

"BMermuys" <so*****@someon e.com> wrote in message
news:QS******** *************** @phobos.telenet-ops.be...

"Daniel P." <da******@hotma il.comU> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
> Thanks! That did it. The worker thread is doing its job while the main > thread displays the updated timer.
> Is there a more efficient way to wait for the worker thread then using Sleep
> as below?
> I was thinking to use a callback to the main thread but that creates
strong
> coupling.
>
> Thread t = new Thread(new ThreadStart( myObj.ThreadPro c ) );
> t.Start();
>
> while( true == t.IsAlive )
> {
> Thread.Sleep(10 00);
> UpdateTimeElaps ed();
> }
>

If you wait for the thread to end, then you don't gain much by using a
worker thread. You're are still blocking the message loop this way,
remember that's it's no good to do lenghty operations inside

eventhandlers,
they make the UI non-responsive.

Start the timer and thread, don't wait for the thread to end, but let the thread fire an event when it's done, and from that event you could
stop
the
timer.
HTH,
greetings

>
> "BMermuys" <so*****@someon e.com> wrote in message
> news:29******** *************** @phobos.telenet-ops.be...
> > Hi,
> > inline
> >
> > "Daniel P." <da******@hotma il.comU> wrote in message
> > news:u8******** ******@TK2MSFTN GP12.phx.gbl...
> > > I'm trying to set a timer that gets called every 3 seconds so I can > update
> > a
> > > field in the UI with the time elapsed since the process started.
> > >
> > > What am I doing wrong that timerDF_Tick does not get called?
> > >
> > >
> >
> > The timer event can only fire if the message loop is running and it's > > blocked because the 10minute during sp is executed inside an event
handler
> > (or inside a function that's called from an event handler).
> >
> > There are other timers that can fire while the message loop is

blocked,
> but
> > it won't do you any good because then you would have to marshal
from a > > system thread to the UI thread, which also doesn't work when the

message
> > loop is blocked.
> >
> > What you need to do : call this 10minute stored procedure from a
> > workerthread. Then the message-loop won't be blocked and timer

event's
> will
> > fire.
> >
> > eg:
> >
> > public void SomeMethod()
> > {
> > > private System.Windows. Forms.Timer timerDF;
> > > this.timerDF = new System.Windows. Forms.Timer(thi s.components);
> > >
> > > this.timerDF.In terval = 3000;
> > > this.timerDF.Ti ck += new System.EventHan dler(this.timer DF_Tick);
> > >
> > > timerDF.Enabled = true;
> > > timerDF.Start() ;
> > >
> > Thread tr = new Thread(new ThreadStart(Run SP));
> > tr.Start();
> > }
> >
> > public void RunSP()
> > {
> > // here you should call a stored procedure that takes

about 10
> > minutes to run,
> > // so it doesn't block the UI thread (message loop)
> > }
> >
> >
> > HTH,
> > greetings
> >
> >
> > > private void timerDF_Tick(ob ject sender, System.EventArg s e)
> > > {
> > > DateTime dt2 = DateTime.Now;
> > > TimeSpan diff = dt2 - dt1 ;
> > >
> > > textProcessTime .Text = string.Format( "{0}:{1}:{2 }",
> > > diff.Hours.ToSt ring("00"),
> > > diff.Minutes.To String("00"),
> > > diff.Seconds.To String("00") );
> > >
> > > textProcessTime .Update();
> > >
> > > this.Update();
> > > }
> > >
> > >
> >
> >
>
>



Nov 16 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2193
by: Joe | last post by:
Hi, I am trying to alter the refresh rate of an online webpage in a webbrowser control using MFC. However the Timer ID is stored in a local variable and I don't know how to access it. Is there a technique in Javascript that I might be able to use/adapt? I have a timer set within a prototype thus: ;HControl.prototype.setFLTimeout = function() {
5
2181
by: csgraham74 | last post by:
HI all, I want to implement this scenario: I need my ASP.NET website to check a SQL table every 30 seconds and if there is a change to display a message to user. I have created a panel control (pnlMessage) and placed the message on it also made it default to visible = false. I have placed a Timer control on my ASP.NET Web Form and set its Interval = 30000 (30 seconds) it fires ok every 30 seconds and the code executes it hits the line...
7
2667
by: Mike Eaton | last post by:
Hi All, I have a simple application that allows users to clock in and out and stores the data for use by the payroll department. It spends most of its life as a tray icon and when the user clicks on it, a clock-in/out form is displayed. My problem is this: I've added a timer to the main module to allow the user to set a time to be reminded that they should clock back in/out. The timer works great (i.e. if it's set to remind you at...
4
1488
by: Altman | last post by:
I want to start a timer when an object loads, so I put the code to start it in the constructor. The problem I am having is that when I put the object on a form in development it starts the timer. Is there a way to get this so that it doesn't run unless the program has actually started?
5
1486
by: Tom Edelbrok | last post by:
I have narrowed down a previous problem to the following more specific items: 1) I have my startup object in VB.NET (VS 2003) set to Sub Main(). 2) Inside of Sub Main() I do a "Application.Run(MyMainForm)" 3) Inside of MyMainForm_Load I create an object, ie: "poMyObj=new clsMyObj" 4) Within poMyObj I create a new System.Threading.Timer instance. I use a
19
3094
by: arunkumar_m2001 | last post by:
Can Somebody help me to code a timed test. Actually I want to implement a timer in a web application which will pop-up an alert automatically by refreshing the web page after a specific time. Thanks Arun
0
890
by: John Mason | last post by:
Hello, I have a small client app using a timer control that communicates with a Windows service using .NET remoting. Both apps were authored against the 1.1.4322 framework. The timer controls the periodicity for refreshing the details/progress of the Windows service. This all works perfectly in my test environment running 1.1. The production environment runs off the 2.0 framework. The Windows service (which uses no timers) runs fine,...
12
5519
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different directories and updating a database. No interaction with the GUI. Problem is that the system timers do not have a tag property so I can tie in an object. example (old way):
2
1544
by: Elliot | last post by:
My program use a timer to 'refresh' a method "a" every several seconds, private void a(object sender, EventArgs eArgs) { Timer T1 = new Timer(); T1.Interval = 100000; T1.Start(); T1.Tick += new EventHandler(b); Timer T2 = new Timer();
0
8129
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8220
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5509
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4017
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4080
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1386
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.