private void btnEditar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { EdicionEmpleado frm = new EdicionEmpleado(); Bitmap nbitmap; frm.txbIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.txbNombres.Text = dtgRegistros.CurrentRow.Cells["Nombres"].Value.ToString(); frm.txbApellidos.Text = dtgRegistros.CurrentRow.Cells["Apellidos"].Value.ToString(); frm.txbDireccion.Text = dtgRegistros.CurrentRow.Cells["Direccion"].Value.ToString(); frm.txbTelefono.Text = dtgRegistros.CurrentRow.Cells["Telefono"].Value.ToString(); frm.dtpFechaNacimiento.Text = dtgRegistros.CurrentRow.Cells["FechaNacimiento"].Value.ToString(); frm.cbbGenero.Text = dtgRegistros.CurrentRow.Cells["Genero"].Value.ToString(); frm.txbDUI.Text = dtgRegistros.CurrentRow.Cells["DUI"].Value.ToString(); frm.txbEmail.Text = dtgRegistros.CurrentRow.Cells["Email"].Value.ToString(); nbitmap = aImagen((byte[])dtgRegistros.CurrentRow.Cells["Foto"].Value); frm.pbFotoEmpleado.Image = new Bitmap(nbitmap); frm.ShowDialog(); CargarDatos(); } } catch { MessageBox.Show("Ocurrio un Error a la hora de EDITAR", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAgregar_Click(object sender, EventArgs e) { EdicionEmpleado frm = new EdicionEmpleado(); frm.ShowDialog(); CargarDatos(); }
private void btnEditar_Click(object sender, EventArgs e) { if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { EdicionEmpleado frm = new EdicionEmpleado(); frm.txbIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.txbNombres.Text = dtgRegistros.CurrentRow.Cells["Nombres"].Value.ToString(); frm.txbApellidos.Text = dtgRegistros.CurrentRow.Cells["Apellidos"].Value.ToString(); frm.dtpFechaNacimiento.Text = dtgRegistros.CurrentRow.Cells["FechaNacimiento"].Value.ToString(); frm.cbbGenero.Text = dtgRegistros.CurrentRow.Cells["Genero"].Value.ToString(); frm.ShowDialog(); CargarDatos(); } }
private void btnEditar_Click(object sender, EventArgs e) { EdicionEmpleado frm = new EdicionEmpleado(); frm.txtIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.txtNombres.Text = dtgRegistros.CurrentRow.Cells["Nombres"].Value.ToString(); frm.txtApellidos.Text = dtgRegistros.CurrentRow.Cells["Apellidos"].Value.ToString(); frm.dtFecha.Text = dtgRegistros.CurrentRow.Cells["FechaNacimiento"].Value.ToString(); frm.cmbGenero.SelectedItem = dtgRegistros.CurrentRow.Cells["Genero"].Value.ToString(); DataGridViewRow row = dtgRegistros.CurrentRow; DataRowView rows = row.DataBoundItem as DataRowView; frm.pbxFoto.Image = Functions.Class1.ByteArrayToImage((byte[])rows["Foto"]); frm.ShowDialog(); CargarDatos(); }