private void bt_gestionCourt_modif_valid_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Êtes vous sûr de vouloir modifier les informations du Court ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { int indexCourt = GestionClub.getIndexOfCourt(Convert.ToInt32(tb_gestionCourt_modif_num.Text)); //On vérifie que l'utilisateur a bien modifié la valeur avant de faire un setter try { if (tb_gestionCourt_modif_nbPlaces.Text != GestionClub.getTousLesCourts()[indexCourt].getNbPlaces().ToString()) { GestionClub.getTousLesCourts()[indexCourt].setNbPLaces(Convert.ToInt32(tb_gestionCourt_modif_nbPlaces.Text)); } MessageBox.Show("La modification a bien été réalisée"); Form_gestionCourt_modif.ActiveForm.Close(); Form_gestionCourt_Afficher form_gestionCourt_Afficher = new Form_gestionCourt_Afficher(); form_gestionCourt_Afficher.ShowDialog(); } catch { MessageBox.Show("Une erreur est survenue pendant la modification, veuillez vérifier que tous les champs soient remplis et que ce soit seulement des numériques"); } } }
private void bt_gestionCourt_Afficher_Click(object sender, EventArgs e) { Form_gestionCourt_Afficher from_GestionCourt_afficher = new Form_gestionCourt_Afficher(); from_GestionCourt_afficher.ShowDialog(); }