本文介绍了我正在循环并将文本写入标签,但它不会像执行步骤1那样重复,执行步骤2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for(int i = 0 ; i< = dtSteps.Rows.Count - 1; i ++)

&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP;   



  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP;&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; lblCompleteProgress.Text =" Executing Step" + i +"的" + dtSteps.Rows.Count;



&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }

推荐答案

我希望循环执行得如此之快,以至于你将无法看到

amy的变化除了最后一个。如果您希望能够看到标签中的值发生变化,那么您需要添加一点延迟,例如: -



I expect that loop will execute so quickly that you won't be able to see
amy of the changes except the last one. If you want to be able to watch
the values in the label change, you'll have to add a slight delay, e.g. -

for (int i = 0; i <= dtSteps.Rows.Count - 1; i++)
{
    lblCompleteProgress.Text = "Executing Step " + i + " of" + dtSteps.Rows.Count;
    lblCompleteProgress.Refresh();
    Thread.Sleep(1000);
}

- Wayne

- Wayne


这篇关于我正在循环并将文本写入标签,但它不会像执行步骤1那样重复,执行步骤2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:02