|
-
Oct 29th, 2003, 05:01 AM
#1
Thread Starter
Hyperactive Member
delete listview item
I use this code to remove the item in a ListView.
Dim lvi As ListViewItem = DirectCast(ListView1.Items(1), ListViewItem) '/// where (1) is the index of the item
ListView1.Items.Remove(lvi)
But if there's only one item in the listview, I encounter an error.
What code should I write?
-
Oct 29th, 2003, 06:27 AM
#2
the indexes of a listview in vb.net start at zero , so if you only have one item in the listview it will error on ListView1.Items(1) , because there isn't an item with an index of 1. you would need to specify 0 for the first item
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
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
|