private void btnActualizar_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { if (dataGridView1.SelectedRows.Count > 0) { FrmRegistrarEmpleados E = new FrmRegistrarEmpleados(); E.txtIdE.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); Program.IdCargo = Convert.ToInt32(dataGridView1.CurrentRow.Cells[1].Value.ToString()); E.txtDni.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); E.txtApellidos.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); E.txtNombres.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); if (dataGridView1.CurrentRow.Cells[5].Value.ToString() == "M") { E.rbnMasculino.Checked = true; } else { E.rbnFemenino.Checked = true; } E.dateTimePicker1.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells[6].Value.ToString()); E.txtDireccion.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); E.Visible = true; Visible = false; } dataGridView1.ClearSelection(); timer1.Start(); } }
private void btnNuevo_Click(object sender, EventArgs e) { FrmRegistrarEmpleados E = new FrmRegistrarEmpleados(); E.txtIdE.Text = "0"; Program.IdCargo = 0; dataGridView1.ClearSelection(); E.Visible = true; Visible = false; }