private void btnUpdate_Click(object sender, EventArgs e) { if (cmbOption.SelectedIndex == 0) { frmProductos prods = new frmProductos(); prods.id = int.Parse(dgvData.Rows[dgvData.CurrentRow.Index].Cells[0].Value.ToString()); prods.txProd.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[1].Value.ToString(); prods.txtTipo.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[2].Value.ToString(); prods.txtProv.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[3].Value.ToString(); prods.txtMarca.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[4].Value.ToString(); prods.txtCod.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[5].Value.ToString(); prods.btnInsert.Text = "Actualizar"; prods.ShowDialog(); } else { frmDetalles dets = new frmDetalles(); dets.txtPrecComp.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[2].Value.ToString(); dets.txtprecVenta.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[3].Value.ToString(); dets.txtStock.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[4].Value.ToString(); dets.txtGanancia.Text = dgvData.Rows[dgvData.CurrentRow.Index].Cells[5].Value.ToString(); dets.btnInsert.Text = "Actualizar"; dets.ShowDialog(); } }
private void btnInsert_Click(object sender, EventArgs e) { if (cmbOption.SelectedIndex == 0) { frmProductos prods = new frmProductos(); prods.ShowDialog(); } else { frmDetalles detalles = new frmDetalles(); detalles.ShowDialog(); } }