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

"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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.