TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sudhakargm
NA
1
0
How to delete or Remove Item with image from ListView in C#?
Feb 14 2005 6:20 PM
How to delete or Remove Item with image from ListView in C#? I am creating a ListView and setting a LargeImageItem. I am adding each item of string and index of the image. I also adding image to LargeImageList. Here is the code snippet in C#.NET ListView lstView = null; String fileName; int index = 0; private void addImage(filename, index){ lstView.Items.Add(fileName, index); lstView.LargeImageList.Images.Add(Image.FromFile(fileName)); ... } Now I want to remove item from the ListView. Here is sample code. private void removeImage(index){ lstView.LargeImageList.Images[index].Dispose(); -----line 1 lstView.LargeImageList.Images.RemoveAt(index); -----line 2 lstView.Items[index].Remove(); --line 3 //lstView.Items.RemoveAt(index); --line 4 lstView.Invalidate(); ... } If I use line 1,2,3 then if I try to delete 3rd image out of 5 image item in the list then it deletes 3rd image also deletes last image. If I use only line 3 or 4 then while deleting it works fine but if I add another image then it keeps the old image list pattern no matter which image I add. Does anyone come across this problem? If anyone knows better idea, How to delete ListView item with image associated? And also able to add item after wards. Hope it is interesting problem. Thanks in advance J - Sudhakar
Reply
Answers (
0
)
override delete key in datagrid
Asynchronous Question