private void btnBackup_Click(object sender, EventArgs e) { progressBar.Value = 0; try { if (isValidControl()) { lblStatus.Text = "Backing Up Database. Please Wait..."; FileSettings settings = new FileSettings(); settings.BackupFolders(txtPath.Text); BackupDatabase(txtPath.Text); //Backup(); progressBar.Value = 100; lblPercent.Text = "100 %"; lblStatus.Text = "Backup Complete"; MessageBox.Show("Database has been successfully bucked up", "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show($"Sorry an error occured while backing up database. \n {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }