private void AddProductToListView(IList<QuotationDetail> lstQuotationDetail) { ImageList imgList = new ImageList(); foreach (QuotationDetail detail in lstQuotationDetail) { Image img = PictureUtility.GetImg(detail.Product.Photo); imgList.Images.Add(img); //img.Dispose(); } listView1.View = System.Windows.Forms.View.LargeIcon; imgList.ImageSize = new Size(100, 100); listView1.LargeImageList = imgList; for (int i = 0; i < lstQuotationDetail.Count; i++) { ProductTag tag = new ProductTag(); tag.ProductId = lstQuotationDetail[i].ProductId; tag.ProductCode = lstQuotationDetail[i].Product.ProductCode; tag.Photo = lstQuotationDetail[i].Product.PhotoPath; tag.Quantity = lstQuotationDetail[i].Quantity; //if (listView1.Items.ContainsKey(tag.ProductCode)) //{ // listView1.Items.RemoveByKey(tag.ProductCode); //} ListViewItem item = new ListViewItem(); item.ImageIndex = i; item.Name = tag.ProductCode; item.Text = tag.ProductCode; item.Tag = tag; listView1.Items.Add(item); } }