private void modif_btn_Click(object sender, EventArgs e) { try { int id = 0; string nom = ""; if (string.IsNullOrWhiteSpace(categorie_code_box.Text)) { throw new Ex("vous devez selectionner la commande \n que vous voulez modifier !!"); } else { id = int.Parse(categorie_code_box.Text); } if (string.IsNullOrWhiteSpace(categorie_nom_box.Text)) { throw new Ex("vous devez remplir le champ nom!!"); } else { nom = categorie_nom_box.Text; } db.Modifier_Categorie(id, nom); MessageBox.Show("Succes!"); ClearTextBoxes(); db.Afficher_Categorie(Categorie_grid); } catch (Exception ex) { } }