944,017 Members | Top Members by Rank

Ad:
Mar 24th, 2005
0

Listbox's Remove item

Expand Post »
"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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Turiya is offline Offline
7 posts
since Mar 2005
Mar 24th, 2005
0

Re: Listbox's Remove item

Quote originally posted by Turiya ...
"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
Reputation Points: 13
Solved Threads: 3
Junior Poster in Training
NewVBguy is offline Offline
71 posts
since Mar 2005
Mar 24th, 2005
0

Re: Listbox's Remove item

Quote originally posted by 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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Turiya is offline Offline
7 posts
since Mar 2005
Mar 24th, 2005
0

Re: Listbox's Remove item

I fixed the problem
I was trying to remove an item that didn't exist
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Turiya is offline Offline
7 posts
since Mar 2005
Mar 24th, 2005
0

Re: Listbox's Remove item

Quote originally posted by Turiya ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Turiya is offline Offline
7 posts
since Mar 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Filtering Data Reports....
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: New to VB can someone help ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC