954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Listbox's Remove item

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

Turiya
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 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

NewVBguy
Junior Poster in Training
71 posts since Mar 2005
Reputation Points: 13
Solved Threads: 3
 

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

Turiya
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

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

Turiya
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 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?

Turiya
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You