/// <summary> /// Function for remove ManageOrder. /// </summary> /// <param name="sender">object sender.</param> /// <param name="e">e event.</param> private void buttonRemove_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(textBoxID.Text); if (order.removeOrder(id)) { dataGridView1.DataSource = order.getOrders(); MessageBox.Show("Customer deleted successfuly", "Deleted Customer", MessageBoxButtons.OK, MessageBoxIcon.Information); //// you can clear all textboxes after the delete if you want //// by calling the clear button buttonClearFields.PerformClick(); } else { MessageBox.Show("ERROR - Order NOT deleted", "Deleted Order", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ID Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }