private void btnEdit_Click(object sender, EventArgs e) { if (dgvSanPham.SelectedRows.Count > 0) { if (rowselect == -1 || rowselect >= dsSP.Count) { return; } int vt = 0; for (int i = 0; i < dsSP.Count; i++) { if (dsSP[i].MaSP == int.Parse(dgvSanPham.Rows[rowselect].Cells[0].Value.ToString())) { vt = i; break; } } DataGridViewRow row = dgvSanPham.Rows[vt]; int Ma = int.Parse(row.Cells[0].Value.ToString()); SanPham sp = dsSP.Find(x => x.MaSP == Ma); DetailProduct detail = new DetailProduct(sp); var result = detail.ShowDialog(); LoadData(); } }
private void btnAdd_Click(object sender, EventArgs e) { DetailProduct detail = new DetailProduct(true); var result = detail.ShowDialog(); LoadData(); }