Click here to Skip to main content
15,909,741 members
Home / Discussions / C#
   

C#

 
QuestionKilling threads on form closing... Pin
Jacob Dixon3-Dec-09 2:59
Jacob Dixon3-Dec-09 2:59 
AnswerRe: Killing threads on form closing... Pin
Luc Pattyn3-Dec-09 3:12
sitebuilderLuc Pattyn3-Dec-09 3:12 
GeneralRe: Killing threads on form closing... Pin
Jacob Dixon3-Dec-09 3:19
Jacob Dixon3-Dec-09 3:19 
GeneralRe: Killing threads on form closing... Pin
Luc Pattyn3-Dec-09 3:28
sitebuilderLuc Pattyn3-Dec-09 3:28 
GeneralRe: Killing threads on form closing... Pin
Jacob Dixon3-Dec-09 3:36
Jacob Dixon3-Dec-09 3:36 
GeneralRe: Killing threads on form closing... Pin
Luc Pattyn3-Dec-09 3:58
sitebuilderLuc Pattyn3-Dec-09 3:58 
GeneralRe: Killing threads on form closing... Pin
ely_bob3-Dec-09 8:03
professionalely_bob3-Dec-09 8:03 
AnswerRe: Killing threads on form closing... Pin
Nicholas Butler3-Dec-09 3:17
sitebuilderNicholas Butler3-Dec-09 3:17 
It sounds like your thread is accessing the child form - maybe the progress control? - after the form has closed and been disposed.

Are you sure you want to cancel the thread when the form closes? Wouldn't it be better to allow the thread to complete? If you do want to cancel, you will have to add cancel logic to your thread method. Don't use Thread.Abort() ! If you want to let the thread complete, you will have to make it check if the form still exists before trying to access it.

BTW, Thread.IsBackground just means the thread will be killed when the main form is closed instead of keeping the process running until it has completed.

Nick

----------------------------------
Be excellent to each other Smile | :)

GeneralRe: Killing threads on form closing... Pin
Jacob Dixon3-Dec-09 3:21
Jacob Dixon3-Dec-09 3:21 
GeneralRe: Killing threads on form closing... Pin
Nicholas Butler3-Dec-09 3:36
sitebuilderNicholas Butler3-Dec-09 3:36 
AnswerRe: Killing threads on form closing... Pin
Ian Shlasko3-Dec-09 3:20
Ian Shlasko3-Dec-09 3:20 
GeneralRe: Killing threads on form closing... Pin
Jacob Dixon3-Dec-09 3:32
Jacob Dixon3-Dec-09 3:32 
GeneralRe: Killing threads on form closing... Pin
Ian Shlasko3-Dec-09 4:04
Ian Shlasko3-Dec-09 4:04 
GeneralRe: Killing threads on form closing... Pin
Jacob Dixon3-Dec-09 3:43
Jacob Dixon3-Dec-09 3:43 
GeneralRe: Killing threads on form closing... Pin
Luc Pattyn3-Dec-09 5:38
sitebuilderLuc Pattyn3-Dec-09 5:38 
AnswerRe: Killing threads on form closing... Pin
PIEBALDconsult3-Dec-09 4:49
mvePIEBALDconsult3-Dec-09 4:49 
QuestionRedundant function? Pin
Spoon Of Doom3-Dec-09 2:51
Spoon Of Doom3-Dec-09 2:51 
AnswerRe: Redundant function? Pin
David Skelly3-Dec-09 3:05
David Skelly3-Dec-09 3:05 
AnswerRe: Redundant function? Pin
J4amieC3-Dec-09 3:10
J4amieC3-Dec-09 3:10 
AnswerRe: Redundant function? Pin
Spoon Of Doom3-Dec-09 3:25
Spoon Of Doom3-Dec-09 3:25 
QuestionMaking the code in a DLL invisible Pin
Dewald2-Dec-09 22:18
Dewald2-Dec-09 22:18 
AnswerRe: Making the code in a DLL invisible Pin
Calla2-Dec-09 22:33
Calla2-Dec-09 22:33 
GeneralRe: Making the code in a DLL invisible Pin
Dewald2-Dec-09 22:55
Dewald2-Dec-09 22:55 
AnswerRe: Making the code in a DLL invisible Pin
harold aptroot2-Dec-09 22:38
harold aptroot2-Dec-09 22:38 
GeneralRe: Making the code in a DLL invisible Pin
Dewald2-Dec-09 23:05
Dewald2-Dec-09 23:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.