J
Jim Hammond
The following code tries to excute a function 10 seconds after Page_Load by using a Timer, but the callback never gets called.
private void Page_Load(object sender, System.EventArgs e)
{
// Set timer to call Page_PostLoad in 10 seconds
try
{
// Create the delegate that invokes methods for the timer.
TimerCallback timerDelegate = new TimerCallback(Page_PostLoad);
// Create a timer that invokes once after waiting 10 seconds.
Timer timer = new Timer( timerDelegate, this, 1000, 0 );
// Keep a handle to the timer, so it can be disposed.
tmr = timer;
}
catch(Exception ex)
{
ExceptionDisplay( ex );
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// Set timer to call Page_PostLoad in 10 seconds
try
{
// Create the delegate that invokes methods for the timer.
TimerCallback timerDelegate = new TimerCallback(Page_PostLoad);
// Create a timer that invokes once after waiting 10 seconds.
Timer timer = new Timer( timerDelegate, this, 1000, 0 );
// Keep a handle to the timer, so it can be disposed.
tmr = timer;
}
catch(Exception ex)
{
ExceptionDisplay( ex );
}
}