Listbox's Remove item

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2005
Posts: 8
Reputation: Turiya is an unknown quantity at this point 
Solved Threads: 0
Turiya Turiya is offline Offline
Newbie Poster

Listbox's Remove item

 
0
  #1
Mar 24th, 2005
"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!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 71
Reputation: NewVBguy is an unknown quantity at this point 
Solved Threads: 3
NewVBguy NewVBguy is offline Offline
Junior Poster in Training

Re: Listbox's Remove item

 
0
  #2
Mar 24th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 8
Reputation: Turiya is an unknown quantity at this point 
Solved Threads: 0
Turiya Turiya is offline Offline
Newbie Poster

Re: Listbox's Remove item

 
0
  #3
Mar 24th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 8
Reputation: Turiya is an unknown quantity at this point 
Solved Threads: 0
Turiya Turiya is offline Offline
Newbie Poster

Re: Listbox's Remove item

 
0
  #4
Mar 24th, 2005
I fixed the problem
I was trying to remove an item that didn't exist
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 8
Reputation: Turiya is an unknown quantity at this point 
Solved Threads: 0
Turiya Turiya is offline Offline
Newbie Poster

Re: Listbox's Remove item

 
0
  #5
Mar 24th, 2005
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?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC