Board index » cppbuilder » Re: How to delete correctly an Item inside of TListBox..?

Re: How to delete correctly an Item inside of TListBox..?


2004-10-01 08:57:36 PM
cppbuilder92
Quote
Then I prefer :-

for (int ii=0;ii<ListBox1->Items->Count;++ii)
if (ListBox1->Selected[ii]) { ListBox1->Items->Delete(ii); --ii;}
Why? I would call it bad practice to mess with ii inside the loop.
/Palle
 
 

Re:Re: How to delete correctly an Item inside of TListBox..?

Sorry, I'm just being flippant. You caught me at a bad moment!
--
Mark Jacobs
DK Computing
www.dkcomputing.co.uk
"Palle Meinert" < XXXX@XXXXX.COM >wrote in message
|>Then I prefer :-
|>
|>for (int ii=0;ii<ListBox1->Items->Count;++ii)
|>if (ListBox1->Selected[ii]) { ListBox1->Items->Delete(ii); --ii;}
|
| Why? I would call it bad practice to mess with ii inside the loop.
 

Re:Re: How to delete correctly an Item inside of TListBox..?

Thats okay, at least your are honest about it :-)
/Palle
 

{smallsort}