I have a timer that makes a certain action when it is running (interval of 1000 ms), Is there some way to prevent the timer to start the delay and in the first time instead to go into the function and start to do the code ?
private void timer_Tick(object sender, EventArgs e)
{
labelStatus.Text = "Waiting for next file" + "(" + (class.property / 1000).ToString("#0.##0") + " seconds)";
class.property -= 1000;
}
i want the timer will start immediately to count (update the label) instead of waiting 1 sec before the first label update
What prevents you to extract the code running into the Timer_Elapsed event and create a standalone procedure (a.k.a. Refactoring).
Once you have your procedure call it just before starting the timer.
For example from this:
to ….
and in your code: