private void updateMenuItem_Click(object sender, System.EventArgs e) { int listIndex; Student student; AddUpdateDialog updateDialog = new AddUpdateDialog(); listIndex = this.dataGridView.CurrentRow.Index + 1; student = this.studentList[listIndex]; updateDialog.Text = "Update Student"; updateDialog.Tag = student; if (updateDialog.ShowDialog(this)==DialogResult.OK) { this.studentList.RemoveAt(listIndex); listIndex = ~this.studentList.BinarySearch(student, listOrder); this.studentList.InsertAt(listIndex, student); this.RefreshClientAreaControls(listIndex); } updateDialog.Dispose(); }
private void addMenuItem_Click(object sender, System.EventArgs e) { int listIndex = 0; Student student; AddUpdateDialog addDialog = new AddUpdateDialog(); student = new Student(); student.ID = studentList.AssignID(); addDialog.Text = "Add Student"; addDialog.Tag = student; if (addDialog.ShowDialog(this)==DialogResult.OK) { listIndex = ~this.studentList.BinarySearch(student, listOrder); this.studentList.InsertAt(listIndex, student); this.RefreshClientAreaControls(listIndex); } addDialog.Dispose(); }