C#:
//The "while" below cause and exception:
//System.InvalidOperationException:'Cross-thread operation not valid: Control lstFiles accessed from thread other than the thread it was created on.'
private void watchFinished()
{
do
{
Thread.Sleep(50);
}
while (lstFiles.CheckedItems.Count != 0);
showProgress(prgHole, 100);
string ans = "Done";
if (undeletable.Count != 0)
{
string[] items = new string[undeletable.Count];
undeletable.CopyTo(items, 0);
frmUndeletable frm = new frmUndeletable(items);
frm.ShowDialog();
}
else
ans += ", No Items TO Delete";
MessageBox.Show(ans + " : " + prg.ToString() + " files deleted");
}
请多多包涵,我不写C#,但是我有一个C#程序,它会产生上述错误。
我不需要学习C#,但是我确实需要该程序,如果您能告诉我如何修复它,将不胜感激。
如果我在上面没有提供足够的信息,也许您可以给我一些尝试。
无论如何,我将不胜感激。