I am using a thread to display a progress window while performing a time consuming operation(the for loop).after that operation I want to stop the thread.but the method "ShowProgressDialog" is not being called.I am using the same approach in other event which is working fine.below is the code.
Private Sub TSBRSToLoc_Click(sender As System.Object, e As System.EventArgs) Handles TSBRSToLoc.Click
Try
If Not BWRRStoLoc.IsBusy Then
Dim backgroundThred As New Thread(AddressOf ShowProgressDialog)
backgroundThred.IsBackground = True
'Dim formProgree As New ProgressForm
backgroundThred.Start()
DisableBtns(sender)
ProgressBarCompare.Value = 0
lblProgStatus.Text = ""
Dim filesSize As Long = 0
For index As Integer = 0 To ObjlsViewCompare.Items.Count - 1
Dim file As File = ObjlsViewCompare.GetModelObject(index)
If Not file.Status = MatchStatus.MisingOnRackSpace Then
filesSize = filesSize + file.SizeOnRackSpace
End If
Next
ProgressBarCompare.Maximum = filesSize
' formProgree.Close()
backgroundThred.Abort()
backgroundThred.Join()
BWRRStoLoc.RunWorkerAsync()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub