samedi 28 mars 2015

StopWatch to Show Counter of Elapsed Time?

I have a textbox on my windows form that I am wanting to show the elapsed time that my procedure has taken, but I am not seeing any time counting in the textbox. Below is my code



public partial class Form1 : System.Windows.Forms.Form
{
private Stopwatch watch = new Stopwatch()l

private void btn_RashadSL()
{
watch.Start();
//lots of code here that typically takes around 15 - 20 minutes to complete
}
private void timer_Tick(object sender, EventArgs e)
{
textbox1.Text = watch.Elapsed.Seconds.ToString();
}
}

Aucun commentaire:

Enregistrer un commentaire