How to remove items in a listview? 
Author Message
 How to remove items in a listview?

How can I remove selected items from a list in a listview.
I'm looking for a good example, because I have a little trouble getting the
selected items.

Thanks,
Ivo



Mon, 24 Nov 2003 18:51:28 GMT  
 How to remove items in a listview?
'Lets say your ListView is called ListView1.
'You click on a row/item in the list viewview.
'To Remove that Item by clicking a button called RemBtn.

sub RemBtn_Click
    ListView1.ListItems.Remove(ListView1.SelectedItem.Index)
    ListView1.Refresh
end sub

If you have multiple Listitems selected and you want to remove them than
create a loop:

dim x a slong
x=0

for x = Listview1.ListItems.Count to 1 Step -1
    if ListView1.ListItems(x).Selected = True then
        ListView1.ListItems.Remove(ListView1.ListItems(x).Index)
    endif
next x

Hope this helps,
John.


How can I remove selected items from a list in a listview.
I'm looking for a good example, because I have a little trouble getting the
selected items.

Thanks,
Ivo



Mon, 24 Nov 2003 19:06:30 GMT  
 How to remove items in a listview?
This works. Thanks a lot.
The only problem I still have is;
The first item in the list is (default?) selected = true. In spite of the item
not being selected (by any clicking with mouse or keypress).

Bye,
Ivo

Quote:
-----Original Message-----

'Lets say your ListView is called ListView1.
'You click on a row/item in the list viewview.
'To Remove that Item by clicking a button called RemBtn.

sub RemBtn_Click
    ListView1.ListItems.Remove(ListView1.SelectedItem.Index)
    ListView1.Refresh
end sub

If you have multiple Listitems selected and you want to remove them than
create a loop:

dim x a slong
x=0

for x = Listview1.ListItems.Count to 1 Step -1
    if ListView1.ListItems(x).Selected = True then
        ListView1.ListItems.Remove(ListView1.ListItems(x).Index)
    endif
next x

Hope this helps,
John.



How can I remove selected items from a list in a listview.
I'm looking for a good example, because I have a little trouble getting the
selected items.

Thanks,
Ivo

.



Mon, 24 Nov 2003 19:29:42 GMT  
 How to remove items in a listview?
Hi,
  I had a form with a Listview and a Remove button
clicking on which the user could remove items from the
listview. Although there appeared to be no visual
selection (nothing highlighted), by default the focus
seemed to be on the first item cause in my Remove button
click logic, I was looping through the listview items and
removing anything that had a focus.
  I could not see any place where the focus was getting
set in the code. So, I worked around this by manually
setting the .selected property to false when I was loading
the list view with items.

Rachel

Quote:
>-----Original Message-----
>This works. Thanks a lot.
>The only problem I still have is;
>The first item in the list is (default?) selected = true.

In spite of the item
Quote:
>not being selected (by any clicking with mouse or
keypress).

>Bye,
>Ivo

>-----Original Message-----
>'Lets say your ListView is called ListView1.
>'You click on a row/item in the list viewview.
>'To Remove that Item by clicking a button called RemBtn.

>sub RemBtn_Click
>    ListView1.ListItems.Remove

(ListView1.SelectedItem.Index)
Quote:
>    ListView1.Refresh
>end sub

>If you have multiple Listitems selected and you want to
remove them than
>create a loop:

>dim x a slong
>x=0

>for x = Listview1.ListItems.Count to 1 Step -1
>    if ListView1.ListItems(x).Selected = True then
>        ListView1.ListItems.Remove(ListView1.ListItems
(x).Index)
>    endif
>next x

>Hope this helps,
>John.



>How can I remove selected items from a list in a listview.
>I'm looking for a good example, because I have a little
trouble getting the
>selected items.

>Thanks,
>Ivo

>..

>.



Tue, 09 Dec 2003 12:49:36 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. help adding and removing items from a listview

2. How to remove items from the listview control ?

3. ListView Control - Removing selected items from the list

4. Removing an item from a listview

5. Removing an item from a ListView

6. Q: How to get rid of ListView flicker when adding/removing items

7. SHFileOp and removing corresponding items from ListView

8. removing items from a listview

9. Remove Selected item in ListView Control

10. ListView items remain indented after removing icons

11. Remove selected items from a listview control in report format

12. ListView: Remove items *AND* rows???

 

 
Powered by phpBB® Forum Software