This is the setup I have, this code works properly
private void butGo_Click(object sender, EventArgs e)
{
threadCreateImages.RunWorkerAsync();
}
private void threadCreateImages_DoWork(object sender, DoWorkEventArgs e)
{
PatientToHL7MSHManager tvPatientToHL7MSHManager = new PatientToHL7MSHManager();
tvPatientToHL7MSHManager.LoadByMSHID("");
}
private void threadCreateImages_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
MessageBox.Show("DONE");
}
if I change this line tvPatientToHL7MSHManager.LoadByMSHID(""); to tvPatientToHL7MSHManager.LoadByPatientID("");
It skips over the DoWork event and goes straight to the RunWorkerCompleted event.
The only difference between the LoadByMSHID and the LoadByPatientID is the filter on the SQL statement besides that the code path is identical.
The code does work properly without the background thread.
Any ideas or suggestions would be very appreciated.