private void btnEditar_Click(object sender, EventArgs e) { try { if (GridProductos.SelectedRows.Count == 1) { FormMantProductos frm = new FormMantProductos(); frm.IsInsert = false; frm.txtid.Text = GridProductos.CurrentRow.Cells[0].Value.ToString(); frm.txtProducto.Text = GridProductos.CurrentRow.Cells[1].Value.ToString(); frm.txtDescripcion.Text = GridProductos.CurrentRow.Cells[2].Value.ToString(); frm.txtPrecio.Text = GridProductos.CurrentRow.Cells[3].Value.ToString(); frm.cbCategoria.SelectedItem = GridProductos.CurrentRow.Cells[4].Value.ToString(); frm.cbUnidades.SelectedItem = GridProductos.CurrentRow.Cells[5].Value.ToString(); frm.cbImpuestos.SelectedItem = GridProductos.CurrentRow.Cells[6].Value.ToString(); frm.FormClosed += new FormClosedEventHandler(Form3_Closed); frm.ShowDialog(); } else { MessageBox.Show("seleccione una fila por favor"); } } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.ToString()); } }
private void btnNuevo_Click(object sender, EventArgs e) { FormMantProductos frm = new FormMantProductos(); frm.IsInsert = true; frm.FormClosed += new FormClosedEventHandler(Form3_Closed); frm.ShowDialog(); }