private void DgvSellPro_CellClick(object sender, DataGridViewCellEventArgs e) { gbSellPro.Visible = true; string sellProName = null, sellProPrice = null, sellProExp = null; if (dgvSellPro.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { dgvSellPro.CurrentRow.Selected = true; sellProName = dgvSellPro.Rows[e.RowIndex].Cells["sellProName"].FormattedValue.ToString(); sellProPrice = dgvSellPro.Rows[e.RowIndex].Cells["sellProPrice"].FormattedValue.ToString(); sellProExp = dgvSellPro.Rows[e.RowIndex].Cells["sellProExp"].FormattedValue.ToString(); } sellProID = HelperProduct.GetProductID(sellProName, Convert.ToDouble(sellProPrice), sellProExp); tbSelectedPro.Text = HelperProduct.GetProduct(sellProID).proName; }
private void DgvProducts_CellClick(object sender, DataGridViewCellEventArgs e) { lblWarningPro.Visible = false; string proName = null, proCate = null, prePrice = null, salePrice = null, stock = null, explanation = null; if (dgvProducts.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { dgvProducts.CurrentRow.Selected = true; proName = dgvProducts.Rows[e.RowIndex].Cells["proName"].FormattedValue.ToString(); proCate = dgvProducts.Rows[e.RowIndex].Cells["proCate"].FormattedValue.ToString(); prePrice = dgvProducts.Rows[e.RowIndex].Cells["prePrice"].FormattedValue.ToString(); salePrice = dgvProducts.Rows[e.RowIndex].Cells["salePrice"].FormattedValue.ToString(); stock = dgvProducts.Rows[e.RowIndex].Cells["stock"].FormattedValue.ToString(); explanation = dgvProducts.Rows[e.RowIndex].Cells["explanation"].FormattedValue.ToString(); } proID = HelperProduct.GetProductID(proName, proCate, Convert.ToDouble(prePrice), Convert.ToDouble(salePrice), Convert.ToInt32(stock), explanation); }