コード例 #1
0
ファイル: Setup.cs プロジェクト: kostacoffee/ExamAttend
 //Adds students to the gridView based on the subject given.
 private void addStudents(Subject subject)
 {
     Student[] students = studentDatabase.getStudents(subject);
     for (int i = 0; i < students.Length; i++) {
         studentsGrid.addRecord(students[i]);
     }
 }
コード例 #2
0
ファイル: Setup.cs プロジェクト: kostacoffee/ExamAttend
 //Used to allow for right-clicking to remove subjects
 private void selectSubjectToRemove(object sender, MouseEventArgs e)
 {
     //http://stackoverflow.com/questions/5239913/get-rowindex-via-contextmenu
      	        if (e.Button == MouseButtons.Right) {
         DataGridView.HitTestInfo hit = ui.subjects.HitTest(e.X, e.Y);
         if (hit.Type == DataGridViewHitTestType.Cell)
         {
             subjectToRemove = (Subject)ui.subjects.Rows[hit.RowIndex].Cells[0].Value;
             ui.subjects.ContextMenuStrip.Items.Clear();
             ui.subjects.ContextMenuStrip.Items.Add("Remove " + subjectToRemove.ToString());
         }
     }
 }
コード例 #3
0
ファイル: Setup.cs プロジェクト: kostacoffee/ExamAttend
 //Removes all students for a particular subject from the gridView.
 private void removeStudents(Subject subject)
 {
     Student[] students = studentDatabase.getStudents(subject);
     foreach (Student s in students) {
         studentsGrid.removeRecord(s);
     }
 }