private void Button2_Click_1(object sender, EventArgs e) { //btn choix product try { //bring Product for sale id name and unit price lstProduct lst = new lstProduct(); lst.ShowDialog(); int ss = Convert.ToInt32(lst.dgv_lstPrd.CurrentRow.Cells[0].Value); for (int i = 0; i < dgv_detaills.Rows.Count; i++) { if (Convert.ToInt32(dgv_detaills.Rows[i].Cells[0].Value) == ss) { MessageBox.Show("Ce produit ce trouve déja dans la liste des ventes", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } txtIdP.Text = lst.dgv_lstPrd.CurrentRow.Cells[0].Value.ToString(); // id product txtNomP.Text = lst.dgv_lstPrd.CurrentRow.Cells[1].Value.ToString(); // Product name or lebele //txtPrixVU.Text= lst.dgv_lstPrd.CurrentRow.Cells[4].Value.ToString(); // unite sale price // groupBox4.Controls.Remove(lbl3); createLabel(385, 202, "*", Color.Green, lbl3); groupBox4.Controls.Add(lbl3); lbl3.Show(); } catch { return; } }
private void Button2_Click(object sender, EventArgs e) { try { lstProduct lst = new lstProduct(); lst.ShowDialog(); txtIdP.Text = lst.dgv_lstPrd.CurrentRow.Cells[0].Value.ToString(); txtNomP.Text = lst.dgv_lstPrd.CurrentRow.Cells[1].Value.ToString(); } catch { return; } }