private void bt_Delete_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(comboBoxCompany.Text)) { MessageBox.Show("Please check the company's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { connectionDB.DeleteCompanyInDatagridView(comboBoxCompany.Text, comboBoxEmail.Text, dataGridViewList); } } catch (Exception er) { MessageBox.Show(er.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } dataGridViewList.AutoResizeColumns(); }