I'm trying to load a bunch of files from a directory, and while it's loading, display a progress bar status, as well as a label that displays which file is being processed.
private void FileWorker_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 0; i < Files.Length; i++)
{
Library.AddSong(Files[i]);
FileWorker.ReportProgress(i);
}
}
At the moment it processes everything properly, and the progress bar displays status properly, but when i try to change the label's text (lblfile.text) it says it cannot change a control on a different thread. Is there a way to change the text of lblfile.text from the Fileworker?