private void btnNuevo_Click(object sender, EventArgs e)
        {
            FrmRegistrarEmpleados E = new FrmRegistrarEmpleados();

            E.txtIdE.Text   = "0";
            Program.IdCargo = 0;
            E.Show();
            dataGridView1.ClearSelection();
        }
 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();
             if (dataGridView1.CurrentRow.Cells[8].Value.ToString() == "S")
             {
                 E.cbxEstadoCivil.SelectedIndex = 1;
             }
             else
             if (dataGridView1.CurrentRow.Cells[8].Value.ToString() == "C")
             {
                 E.cbxEstadoCivil.SelectedIndex = 2;
             }
             else
             if (dataGridView1.CurrentRow.Cells[8].Value.ToString() == "D")
             {
                 E.cbxEstadoCivil.SelectedIndex = 3;
             }
             else
             {
                 E.cbxEstadoCivil.SelectedIndex = 4;
             }
             E.Show();
         }
         dataGridView1.ClearSelection();
         timer1.Start();
     }
 }