private void dgvBranch_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3 && e.RowIndex >= 0 && e.RowIndex < dgvBranch.RowCount) { CourseForm cForm = new CourseForm( int.Parse(dgvBranch[0, e.RowIndex].Value.ToString()), dgvBranch[1, e.RowIndex].Value.ToString(), dgvBranch[2, e.RowIndex].Value.ToString()); this.Hide(); cForm.ShowDialog(); this.Show(); } }