【发布时间】:2016-09-11 14:26:20
【问题描述】:
我想显示我的 Excel 阅读程序的进度。 这里有一些代码:
public void ReadExcel()
{
//Do something (get Excel File...)
txtProgress.Text += "Start";
int rows = exRng.Rows.Count;
int column = exRng.Columns.Count;
progProgress.Maximum = rows;//ProgressBar
txtProgress.Text += "Start";//TextBlock
for (int i = 1; i <= rows; i++)
{
progProgress.Value = i;
//Do something
txtProgress.Text += "\n " + Name + " was created";
}
}
ProgressBar 最大值是 excel 文件中的行数。在每个循环之后,TextBlock 应该显示该名称已创建。 ProgressBar 值应显示进度。
我的窗口如下所示: Window with a Textblock at the top and a ProgressBar at the bottom
但窗口只显示 Excel 读取的结束。它不会刷新 TextBlock 或 ProgressBar。我只看到空窗口,最后是这个窗口:End of Progress
有人可以帮助我吗?谢谢
【问题讨论】:
标签: c# wpf excel progress-bar