0

"Invalid procedure call or argument"
As I try to remove an item from a listbox call List1 I try this code...

If List1.List(i) = List1.List(i + 1) Then List1.RemoveItem (i)

if the list contents are identical, remove one of them
but it doesn't work!

2
Contributors
4
Replies
6
Views
12 Years
Discussion Span
Last Post by Turiya
0

"Invalid procedure call or argument"
As I try to remove an item from a listbox call List1 I try this code...

If List1.List(i) = List1.List(i + 1) Then List1.RemoveItem (i)

if the list contents are identical, remove one of them
but it doesn't work!

Hi,
Can you try this one if it works for you.
For example you are trying to compare the column 1 of your list1.
if list1.listitems(i).subitem(1)=list1.listitems(i+1).subitem(1) then
list1.listItems.Remove 1

hope it gives you an idea.

newvbguy

0

Hi,
Can you try this one if it works for you.
For example you are trying to compare the column 1 of your list1.
if list1.listitems(i).subitem(1)=list1.listitems(i+1).subitem(1) then
list1.listItems.Remove 1

hope it gives you an idea.

newvbguy

there is no .listitems property

0

I fixed the problem
I was trying to remove an item that didn't exist

0

I fixed the problem
I was trying to remove an item that didn't exist

how do I set the thread's solved state to solved?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.