朋友们,这是我的代码(如下)。我无法弄清楚为什么值的变化没有反映在进度条上。
void Code()
{
string key;
for (int i = 0; i < 26; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 26; k++)
for (int l = 0; l < 10; l++)
for (int m = 0; m < 26; m++)
{
key = (char)(65 + i) + " " + j.ToString() + " " + (char)(65 + k) + " " + l.ToString() + " " + (char)(65 + m);
File.AppendAllText("D:\\Codes.txt", key + Environment.NewLine);
val = (i + 1) * (j + 1) * (k + 1) * (l + 1) * (m + 1);
MyProgressBar.Value = val;
MyProgressBar.Text = (val * 100 / 1757600).ToString() + "%";
if (val == 1757600)
MessageBox.Show("Code generation completed");
}
}
进度条的值和文本属性与加载时相同。请帮我解决这个问题。提前感谢您的宝贵意见。. .