Reputation: 437
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();
}
}
Upvotes: 0
Views: 962
Reputation: 38825
Given the code you have posted I'd say the problem is that at no point have you set up a timer to actually call the timer_Tick
method.
Upvotes: 1