private void btnEditar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { EdicionUsuario frm = new EdicionUsuario(); frm.btnCambiar.Visible = true; frm.btnCambiar.Enabled = true; frm.txbCredencial.Enabled = false; frm.Width = 357; frm.txbIDUsuario.Text = dtgRegistros.CurrentRow.Cells["IDUsuario"].Value.ToString(); frm.txbUsuario.Text = dtgRegistros.CurrentRow.Cells["Usuario"].Value.ToString(); frm.txbCredencial.Text = dtgRegistros.CurrentRow.Cells["Credencial"].Value.ToString(); frm.txbIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.txbEmpleado.Text = dtgRegistros.CurrentRow.Cells["Nombres"].Value.ToString() + " " + dtgRegistros.CurrentRow.Cells["Apellidos"].Value.ToString(); frm.cbbRol.SelectedValue = dtgRegistros.CurrentRow.Cells["IDRol"].Value.ToString(); 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) { EdicionUsuario frm = new EdicionUsuario(); frm.ShowDialog(); CargarDatos(); }
private void btnEditar_Click(object sender, EventArgs e) { EdicionUsuario frm = new EdicionUsuario(true); frm.txtIDUsuario.Text = dtgRegistros.CurrentRow.Cells["IDUsuario"].Value.ToString(); frm.txtUsuario.Text = dtgRegistros.CurrentRow.Cells["Usuario"].Value.ToString(); frm.txtIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.txtEmpleado.Text = dtgRegistros.CurrentRow.Cells["Nombre"].Value.ToString(); frm.cmbRoles.SelectedValue = dtgRegistros.CurrentRow.Cells["IDRol"].Value.ToString(); 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) { EdicionUsuario frm = new EdicionUsuario(); frm.txbIDUsuario.Text = dtgRegistros.CurrentRow.Cells["IDUsuario"].Value.ToString(); frm.txbUsuario.Text = dtgRegistros.CurrentRow.Cells["Usuario"].Value.ToString(); frm.txbCredencial.Text = dtgRegistros.CurrentRow.Cells["Credencial"].Value.ToString(); frm.txbIDEmpleado.Text = dtgRegistros.CurrentRow.Cells["IDEmpleado"].Value.ToString(); frm.cbbRol.SelectedItem = dtgRegistros.CurrentRow.Cells["IDRol"].Value.ToString(); frm.ShowDialog(); CargarDatos(); } }