【发布时间】:2011-08-06 13:02:49
【问题描述】:
我有以下代码:
private void button1_Click(object sender, EventArgs e)
{
var answer =
MessageBox.Show(
"Do you wish to submit checked items to the ACH bank? \r\n\r\nOnly the items that are checked and have the status 'Entered' will be submitted.",
"Submit",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
if (answer != DialogResult.Yes)
return;
button1.Enabled = false;
progressBar1.Maximum = dataGridView1.Rows.Count;
progressBar1.Minimum = 0;
progressBar1.Value = 0;
progressBar1.Step = 1;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if ((string) row.Cells["Status"].Value == "Entered")
{
progressBar1.PerformStep();
label_Message.Text = @"Sending " + row.Cells["Name"].Value + @" for $" + row.Cells["CheckAmount"].Value + @" to the bank.";
Thread.Sleep(2000);
}
}
label_Message.Text = @"Complete.";
button1.Enabled = true;
}
这是我为移植到我的应用程序而创建的测试。一切正常,但设置了 label_Message.text 。它永远不会出现在屏幕上。它正在设置中,我在上面做了一个 console.write 来验证。它只是不刷新屏幕。最后我也得到了“完成”。
有人有什么想法吗?
【问题讨论】: