in c#, when i add item to listView1 there will be two images via command:
string imgName = ImageList1.Images.Keys[i].ToString();
item.ImageIndex = ImageList1.Images.IndexOfKey(imgName);
listView1.Items.Add(item);
listView1.Update();
PictureBox pic = new PictureBox();
...
listView1.Controls.Add(pic);
adding item to listView1 works fine but when removing item, the image is ok
added by listView1.Controls.Add statement is not deleted, I want to delete this image, how do you write the command? you see my delete code
PictureBox pic = (PictureBox)listView1.SelectedItems[0];
listView1.Controls.Remove(pic);
listView1.SelectedItems[0].Remove();
Dong Lam TrienPosted May 26, 2023, 8:17 AM
I tried running the code you sent me, all didn't work. I have debug variable item.Tag before and after running the code on variable item.Tag nothing changes, this command has no operation listView1.Controls.Remove(pic);
Amit MohantyPosted May 26, 2023, 5:35 AM
Rajkiran SwainPosted May 26, 2023, 5:08 AM