title: How to stop a method which was called by Backgroundworker?
body: <p>I have a backgroundworker. When it start it call a method to send record from a database to another webservice. </p>
  
  <p>Problem is I made a stop button to stop the job sending but it didn't work. </p>
  
  <p>I try to  dispose backgroundworker or CancelAsync but that method still running (My app is a windows form app so I know that method is still running). Anyone can give me a solution for this ? Tks so much!</p>
  
  <p>My code : </p>
  
  <pre><code> private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
          {
              Send();
          }
  </code></pre>
  
  <p>Stop button</p>
  
  <pre><code>private void btnStop_Click(object sender, EventArgs e)
          {            
              try
              {
                 backgroundWorker1.CancelAsync();   
                 backgroundWorker1.Dispose();                                
              }
              catch (Exception ex)
              {
                  Global._logger.Info(ex.Message + ex.Source);
                  ShowError(ex.Message);
              }
  
          }
  </code></pre>
  
  <p>Note : The method Send() will call another method to send record after checking DB. </p>