habilitacion y deshabilitacion de botones en personal

This commit is contained in:
carlos
2024-01-07 17:51:59 -06:00
parent e26af85c23
commit 210203da3e
10 changed files with 211 additions and 187 deletions
+37 -3
View File
@@ -17,8 +17,9 @@ namespace compabetov2
public personal()
{
InitializeComponent();
llenarGrid();
llenarGrid();
}
private void label1_Click(object sender, EventArgs e)
{
@@ -48,7 +49,6 @@ namespace compabetov2
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void llenarGrid()
@@ -72,6 +72,7 @@ namespace compabetov2
empleado.fecha_nac,
empleado.telefono);
}
dataGridView1.Enabled = false;
}
private void personal_Load(object sender, EventArgs e)
@@ -81,12 +82,45 @@ namespace compabetov2
private void button7_Click(object sender, EventArgs e)
{
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
dataGridView1.Enabled = true;
btnAgregar.Enabled = false;
}
private void button8_Click(object sender, EventArgs e)
{
}
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex] as DataGridViewRow;
if(row.Cells[1].Value != null && row.Cells[0].Value != null)
{
txtnombrepersonal.Text = row.Cells[1].Value.ToString();
txtapellidopersonal.Text = row.Cells[2].Value.ToString();
dtpfechapersonal.Text = row.Cells[3].Value.ToString();
cbestadopersonal.Text = row.Cells[4].Value.ToString();
txtcallepersonal.Text = row.Cells[5].Value.ToString();
txtcoloniapersonal.Text = row.Cells[6].Value.ToString();
txtcodigopersonal.Text = row.Cells[7].Value.ToString();
txtnoextpersonal.Text = row.Cells[8].Value.ToString();
txtnointpersonal.Text = row.Cells[9].Value.ToString();
txtreferenciapersonal.Text = row.Cells[10].Value.ToString();
dtpnacimientopersonal.Text = row.Cells[11].Value.ToString();
txttelefonopersonal.Text = row.Cells[12].Value.ToString();
}
}
private void btnNuevo_Click(object sender, EventArgs e)
{
btnEditar.Enabled = false;
btnEliminar.Enabled = false;
btnAgregar.Enabled = true;
dataGridView1.Enabled = false;
}
}
}