private void HangHoaItem_click(object sender, EventArgs e) { uFrmHangHoa frm = sender as uFrmHangHoa; HangHoaRead clickedHangHoa = frm.Tag as HangHoaRead; AddHangHoaDuocChon(clickedHangHoa); }
void RenderDanhSachHangHoa(List <HangHoaRead> dsHangHoa) { flpDanhSachHangHoa.Controls.Clear(); foreach (HangHoaRead hangHoa in dsHangHoa) { uFrmHangHoa box = new uFrmHangHoa(hangHoa.TenHang, hangHoa.GiaBanStr, hangHoa.HinhAnh); box.Tag = hangHoa; box.Click += HangHoaItem_click; flpDanhSachHangHoa.Controls.Add(box); } }