private void LlenarCampos() { try { Program.Evento = 1; P.Idempleado = Program.Codigo; DataTable dt = P.DatosEmpleado(); DataTable dt1 = P.DatosIdentificacion(); DataTable dt2 = P.DatosContacto(); DataTable dt3 = P.DatosDireccion(); txtNombre.Text = dt.Rows[0][1].ToString(); txtApellidos.Text = dt.Rows[0][2].ToString(); dtpFechanac.Value = Convert.ToDateTime(dt.Rows[0][3]); cbNacionalidad.SelectedValue = Convert.ToInt32(dt.Rows[0][4]); cbGenero.SelectedValue = dt.Rows[0][5].ToString(); cbEstadoCivil.SelectedValue = dt.Rows[0][6].ToString(); cbCargo.SelectedValue = Convert.ToInt32(dt.Rows[0][7]); cbDpto.SelectedValue = Convert.ToInt32(dt.Rows[0][8]); cbHorario.SelectedValue = Convert.ToInt32(dt.Rows[0][9]); cbSeguro.SelectedValue = Convert.ToInt32(dt.Rows[0][10]); txtSueldo.Text = dt.Rows[0][11].ToString(); for (int x = 0; x < dt3.Rows.Count; x++) { dtgDireccion.Rows.Add(dt3.Rows[x][0]); dtgDireccion.Rows[x].Cells[0].Value = dt3.Rows[x][0].ToString(); dtgDireccion.Rows[x].Cells[1].Value = dt3.Rows[x][1].ToString(); dtgDireccion.Rows[x].Cells[2].Value = dt3.Rows[x][2].ToString(); dtgDireccion.Rows[x].Cells[3].Value = dt3.Rows[x][3].ToString(); dtgDireccion.Rows[x].Cells[4].Value = dt3.Rows[x][4].ToString(); } for (int x = 0; x < dt2.Rows.Count; x++) { dtgContacto.Rows.Add(dt2.Rows[x][0]); dtgContacto.Rows[x].Cells[0].Value = dt2.Rows[x][0].ToString(); dtgContacto.Rows[x].Cells[1].Value = dt2.Rows[x][1].ToString(); dtgContacto.Rows[x].Cells[2].Value = dt2.Rows[x][2].ToString(); dtgContacto.Rows[x].Cells[3].Value = dt2.Rows[x][3].ToString(); } for (int x = 0; x < dt1.Rows.Count; x++) { dtgIdentificacion.Rows.Add(dt2.Rows[x][0]); dtgIdentificacion.Rows[x].Cells[0].Value = dt1.Rows[x][0].ToString(); dtgIdentificacion.Rows[x].Cells[1].Value = dt1.Rows[x][1].ToString(); dtgIdentificacion.Rows[x].Cells[2].Value = dt1.Rows[x][2].ToString(); dtgIdentificacion.Rows[x].Cells[3].Value = dt1.Rows[x][3].ToString(); } } catch (Exception ex) { MessageBoxEx.Show(ex.Message); } }