Before any one comments, ive read all the posts in this subject everything give comments but no CODE....

my app's processing is done in a new thread when the user clicks a button

VB Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.             Dim MyThread As New Thread(AddressOf runProg)
  3.            
  4.             MyThread.Name = "Primary Search Thread"
  5.             MyThread.Start()
  6.             Me.StatusPanel1Status.Text = "Scanning Please Wait!"
  7.  
  8.         End Sub

ok this all works nicely

i then have a sub for when the user closes the application it simple checks if some files exists and if they do to prompt the user wana filter them yes or no if they click no the application quits (but the thread doesnt)


VB Code:
  1. Private Sub MainApp_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
  2.             Dim result As MsgBoxResult = MsgBox("There are still files to filter, do you wish to complete this before exiting", MsgBoxStyle.YesNo, "Input")
  3.  
  4.             If result = MsgBoxResult.Yes Then
  5.                 RunFilter()
  6.             Else
  7.                 'exit the thread here
  8.             End If
  9.  
  10.         End Sub

CODE examples would be really nice right now