Possible Duplicate:
Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
Cross-thread operation not valid
This is my method: (I have seen several other cross thread-related answers but am not understanding how those solution fit my particular case.)
private void live_refresh()
{
while (true)
{
viewBackup.Nodes.Clear();
Control.storage.refresh_files_list();
viewBackup.Nodes.Add(Control.storage.get_files_node());
List<FileInfo> list = Control.sched.get_difference();
this.viewCopy.Items.Clear();
foreach (FileInfo file in list)
this.viewCopy.Items.Add(file.FullName.Substring(Control.filer.get_path().Length + 1));
}
}
}
throws exception: "Cross-thread operation not valid: Control 'viewBackup' accessed from a thread other than the thread it was created on."
can any1 help me solve this problem ? is there any way except the Invoke() ? i don't understand it..