I have a backgroundworker which does a lot of work. Basically it pulls off a massive SQL function and then runs a while loop for every row doing man different things such as creating AD accounts, mailboxes home drives etc.
I need a button which starts the backgroundworker and then when clicked again cancels it. I have tried everything, but it just doesn't work...
private void btn_startSync_Click_1(object sender, EventArgs e)
if (bg_worker.IsBusy != true)
lbl_status.Text = "Status: Started";
lbl_status_main.Text = "Started";
else if (bg_worker.WorkerSupportsCancellation == true && bg_worker.IsBusy == true)
lbl_status.Text = "Status: Stopped";
lbl_status_main.Text = "Stopped";