Solved my own problem. But it is worth being aware of. If your worker thread works the console heavy like this example, that's where it gets hung up. If I quit reporting progress to the console, and instead add a GUI progresscontrol then there are no problems, hang ups, or "not responding" issues.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
for (int bob = 0; bob < 100000; bob++)
{
backgroundWorker1.ReportProgress(bob/1000);
Application.DoEvents();
}
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//Console.WriteLine(e.ProgressPercentage.ToString() + " %");// This will cause 'not responding'
progressBar1.Value = e.ProgressPercentage;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Console.WriteLine("Thread Complete");
progressBar1.Value = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
}






MultiQuote



|