|
-
March 10th, 2005, 10:19 AM
#1
Deleting Multiple Items in Listview
Hi All,
could any one tell me how can i delete multiple items in listview control.
i do this before only for single item.
Code:
ListView.Items.RemoveAt(ListView.SelectedItems(0).Index)
Thanks in Advance
Regards
Gurmeet
-
March 10th, 2005, 01:46 PM
#2
Re: Deleting Multiple Items in Listview
Are you populating the list box from a query if so use the work distinct.
-
March 11th, 2005, 02:21 AM
#3
Re: Deleting Multiple Items in Listview
No i am not populating the listview with a query. Well thanx for ur reply once again.
Any other Expert Guru of Listview? If exist then plz reply my question.
Regards
Gurmeet
Last edited by ss_gurmeet; March 11th, 2005 at 07:20 AM.
-
March 14th, 2005, 02:50 AM
#4
Re: Deleting Multiple Items in Listview
Hi Experts,
Is there no body who has faced the same problem. I dont think that any expert of vb.net could not faced it. plz Guide me what should i do. Any link on web or post will be appreicated.
Thanks in Advance
Best of Luck
Regards
Gurmeet
-
March 14th, 2005, 05:18 AM
#5
Re: Deleting Multiple Items in Listview
ss_gurmeet,
I cannot see the problem.
Are you talking about deleting the selected items in a multiselect listview?
The SelectedItems collection is updated for you when you delete an item, so delete allways the first element:
Code:
For i = 0 To ListView1.SelectedItems.Count - 1 ' This is evaluated only ONCE :)
MsgBox("Notice the updated count : " & ListView1.SelectedItems.Count.ToString)
MsgBox("Deleting item : " & ListView1.SelectedItems(0).Text)
ListView1.Items.RemoveAt(ListView1.SelectedItems(0).Index)
Next
Hope it helps
Last edited by DeepButi; March 14th, 2005 at 05:21 AM.
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
-
March 14th, 2005, 06:57 AM
#6
Re: Deleting Multiple Items in Listview
Hi Deepbuti,
Thank you very much for ur information which u give me (The SelectedItems collection is updated for you when you delete an item, so delete allways the first element). its works fine now.
Best of Luck for ur bright future
Regards
Gurmeet
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|