/// <summary> /// Bouton pour ajouter une note /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAjouter_Click(object sender, EventArgs e) { frmNote noteAjou = new frmNote(); noteAjou.NotesInt = new Notes(); noteAjou.NotesInt.NotesEntier = 1; if (noteAjou.ShowDialog(this) == DialogResult.OK) { lstNotes.Items.Add(noteAjou.NotesInt); ElevesInt.NoteEleve.Add(noteAjou.NotesInt); calculMoyenne(); cmdValiderTest(); } }
/// <summary> /// Bouton pour modifier une note /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdModifier_Click(object sender, EventArgs e) { if (lstNotes.SelectedIndex != -1) { frmNote noteModif = new frmNote(); noteModif.NotesInt = (Notes)lstNotes.SelectedItem; int index = lstNotes.SelectedIndex; if (noteModif.ShowDialog(this) == DialogResult.OK) { lstNotes.Items.RemoveAt(index); ElevesInt.NoteEleve.RemoveAt(index); ElevesInt.NoteEleve.Insert(index, noteModif.NotesInt); lstNotes.Items.Insert(index, noteModif.NotesInt); calculMoyenne(); cmdValiderTest(); } } }