I am trying to read data in a background thread. If the data is from a database or Excel, I check for a null field. If the field is null I want to terminate the process and allow the user to check the entire file for nulls in another subroutine. The process loads another form and the user can check the fields he/she wants to check. I have not figured out the best way to do this and would like suggestions, both for starting the new process, terminating the thread. I can set an error code to check on the RunWorkCompleted event so that should not be a problem. To summarize, the steps are:
1. Detect null field
2. Terminate thread
3. Allow user to choose to check for nulls or skip check. If checking, load form and set list boxes, etc.
4. Ensure proper clean up of objects and garbage collection.
I have done all this when the process was in the main thread. The problem is moving it to the background. If I can't work this out, I'll have to keep it in the main process.