private void ImportDataForm_FormClosing(object sender, FormClosingEventArgs e) { if (backgroundWorkerImport.IsBusy) { e.Cancel = true; MessageBox.Show("The import is still processing.", "Please wait..."); } }