private void btnGuardar_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { char genero = 'n'; Estudiante est = new Estudiante(); est.cedula = txtCédula.Text.ToString(); est.nombre = txtNombre.Text.ToString(); est.primerApellido = txtPriAp.Text.ToString(); est.segundoApellido = txtSegAp.Text.ToString(); est.idNacionalidad = Convert.ToInt32(cboNac.SelectedValue.ToString()); foreach (Control control in pnlGen.Controls) { RadioButton radio = control as RadioButton; if (radio.Checked) { genero = Convert.ToChar(radio.Text.ToString()); } } est.genero = genero; est.fechaNacimiento = DateTime.ParseExact(txtFechNac.Text.ToString(), "d", null); est.fechaExped = DateTime.ParseExact(txtExpedCed.Text.ToString(), "d", null); est.fechaVenc = DateTime.ParseExact(txtExpirCed.Text.ToString(), "d", null); try { EstudianteBLL estuBLL = new EstudianteBLL(); estuBLL.guardarEstudiante(est); MessageBox.Show("Estudiante registrado exitosamete", "Estudiante Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtFechNac.Clear(); txtCedBusqueda.Clear(); txtCédula.Clear(); txtEXP.Clear(); txtExpCed.Clear(); txtExpirCed.Clear(); txtFechNac.Clear(); txtNombre.Clear(); txtSegAp.Clear(); txtPriAp.Clear(); txtExpedCed.Clear(); tsbElim.Enabled = true; tsbInsertar.Enabled = true; tsbMod.Enabled = true; tsbCancelar.Enabled = true; deshabilitarTodo(); cargarNanacionalidades(); tsbMod.Enabled = false; tsbElim.Enabled = false; txtCedBusqueda.Enabled = true; btnBuscar.Enabled = true; } catch (Exception ex) { MessageBox.Show("Error al guardar estudiante" + ex.Message); } } }