Useing threads is a new thing for me so i'd like to know if this is done correctly and if so, is there a better way to do it? It seems to work but i dont really know/understand the consequences.
The scenario -
On form close i need to call a stored procedure to do a whole lot of calculations - its quite a long running procedure. I need this stored procedure to run to completion even if the main application is closed down by the user.
It seems to work as I get the expected results but I dont really know if this is the best way to go about it all.Code:Private Sub DocumentModify_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Dim Thread1 As New System.Threading.Thread(AddressOf ThreadTask) Thread1.Start() ' Start the new thread. End Sub Sub ThreadTask() ' Call the stored procedure here End Sub
Any ideas/suggestions/wraps on the knuckles for doing something stupid?
Thanks
![]()




Reply With Quote