秒表显示经过时间的计数器?

StopWatch to Show Counter of Elapsed Time?

我的 windows 表单上有一个文本框,我想显示我的程序所用的时间,但我没有在文本框中看到任何时间计数。下面是我的代码

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();
  }
}

根据您发布的代码,我想说的是,您从来没有设置计时器来实际调用 timer_Tick 方法。