Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
hello, i use listview in my project and i want to remove item for it, but problem is that when i remove selected item it remove fine. but if i cleck again for remove it show please select item to remove.

so i want, if i select one item to remove in listvew ,item should remove and next item selected automatically.
please help me how , with example.

thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 7-Apr-11 4:33am    
Tag your question! WPF, WinForms, what?. I assumed you use WinForms, so I'm not responsible if it's wrong, as you did not specify it.
--SA
Tarun.K.S 7-Apr-11 4:52am    
Provide more information? What do you mean "it shows please select item to remove" ?

1 solution

Well, do not rely on automatic selection. Calculate the items you need to select or deselect and use System.Windows.Forms.ListViewItem.Selected.

Disclaimer. I assumed System.Windows.Forms as OP did not specify what is used for UI library.

—SA
 
Share this answer
 
v3
Comments
Tarun.K.S 7-Apr-11 4:51am    
OP is using a ListView!
Sergey Alexandrovich Kryukov 7-Apr-11 4:58am    
Oh, thank you very much. Will fix.
--SA
Sergey Alexandrovich Kryukov 7-Apr-11 5:02am    
OK, fixed my Answer -- big deal.
Thank you very much for your help.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900