private void button1_Click(object sender, EventArgs e) { try { اضافه_منتج proo = new اضافه_منتج(); proo.ShowDialog(); dt = pro.ALL_products(); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { try { presentation_layer.اضافه_منتج ad = new اضافه_منتج(); ad.button1.Text = "تعديل"; ad.txt_name.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); ad.txt_price.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); ad.txt_payd_price.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); ad.txt_qun.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); ad.textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); ad.ShowDialog(); dt = pro.ALL_products(); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }