"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!

Recommended Answers

"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 …

Jump to Post

All 4 Replies

"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

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

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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.