Esempio n. 1
0
 private void dGView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         int id = int.Parse(dGView.Rows[e.RowIndex].Cells[1].FormattedValue.ToString());
         if (e.ColumnIndex == 7)
         {
             indexStudent = listStudent.FindIndex(s => s.Id == id);
             DialogResult result = MessageBox.Show("Are you sure want to delete this student ?"
                                                   , "Caption", MessageBoxButtons.YesNo);
             if (result == DialogResult.Yes)
             {
                 listStudent.RemoveAt(indexStudent);
                 ShowStudent(listStudent);
             }
         }
         else if (e.ColumnIndex == 6)
         {
             indexStudent = 0;
             indexStudent = listStudent.FindIndex(s => s.Id == id);
             var newForm = new FormNewStudent();
             newForm.ShowDialog();
             ShowStudent(listStudent);
         }
     }
 }
Esempio n. 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            indexStudent = -1;
            var newForm = new FormNewStudent();

            newForm.ShowDialog();
            ShowStudent(listStudent);
        }