コード例 #1
0
 private void AddStudenButton_Click(object sender, EventArgs e)
 {
     StudentDetailsForm addStudentForm = new StudentDetailsForm();
     addStudentForm.studentListForm = this;
     addStudentForm.Show();
     this.Hide();
 }
コード例 #2
0
        private void StudentsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            // if header row not clicked and Details, Edit or Delete columns are clicked
            if((e.RowIndex != -1) && (e.ColumnIndex > 3))
            {
                // create the new studentDetails form
                StudentDetailsForm StudentDetails = new StudentDetailsForm();
                StudentDetails.studentListForm = this; // make a reference to this form
                StudentDetails.FormType = e.ColumnIndex; // send over the button that is clicked

                // get the student id from the StudentsDataGridView
                StudentDetails.StudentID = Convert.ToInt32(StudentsDataGridView.Rows[e.RowIndex].Cells["StudentID"].Value);

                StudentDetails.Show(); // show the studentDetails Form
                this.Hide(); // hide this form
            }
        }