Windows Develop Bookmark and Share   
 index > Windows Forms General > Thread not abort when the form closes
 

Thread not abort when the form closes

Hi guys,

I have built a multi-threaded User Control that is used inside a WinForm. Sometimes when I close the form I got exception. The exception is caused by the thread inside the user control, it is still running even the form is closed.

Exception: Object reference not set to an instance of an object.

Since I am not allowed to touch the winform, I am planning to put myThread.Abort() inside the Dispose method of my user control.

Is it the proper way to kill the thread?

Thanks in advance.

Michael 
MigrationUser 1  Thursday, February 17, 2005 8:39 PM
Hi,

Well I am too not very good in Vb.Net but this is how i do the stuff...

YOu need to close all threads that your application start somewhere in your application and the best place is UserCOntrol Dispose method....

MigrationUser 1  Sunday, February 20, 2005 12:38 AM

You can use google to search for other answers

Custom Search

More Threads

• Index of 1st visible character (TextBox)
• laptop for .NET development?
• RegionMaster C# to VB.NET References
• How to make the window always on top of the main/parent window but not "always on top" to all opened windows?
• Emulating or creating a ramdisk type in .NET
• Can I add panel to statusStrip ?
• Treeview AfterSelect and TextBox Focus
• Missing XML comment error msg
• SafeFileName
• How to get focus on Form