private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { Int64 ID = Convert.ToInt64(dataGridView1.CurrentRow.Cells[13].Value); EstudianteSeleccionado = EstudianteDB.SeleccionarEstudiante(ID); this.Close(); frmCargaEstudiante pEstudiante = new frmCargaEstudiante(); pEstudiante.Show(); } else { MessageBox.Show("Error, No se ha seleccionado ningun Estudiante, Seleccione otra vez", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnSeleccionarAlumno_Click(object sender, EventArgs e) { try { if (dataGridView1.SelectedRows.Count == 1) { Int64 ID = Convert.ToInt32(dataGridView1.CurrentRow.Cells[12].Value); EstudianteSeleccionado = EstudianteDB.SeleccionarEstudiante(ID); this.Close(); } else { MessageBox.Show("Error, No se ha seleccionado ningun Estudiante, Seleccione otra vez", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEliminar_Click(object sender, EventArgs e) { frmRegistro re = new frmRegistro(); if (dataGridView1.SelectedRows.Count == 1) { try { int ID = Convert.ToInt32(dataGridView1.CurrentRow.Cells[12].Value); re.GetIDestudiante = EstudianteDB.SeleccionarEstudiante(ID); re.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No se ha seleccionado un estudiante de la tabla", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }