Man you've got to be quick to get your answer on to the List, I've just
posted mine and received 4 other worthy replies.


Rob

Software engineer
Wild Software Ltd
Ph 03 338-1407
----- Original Message -----
From: "Alistair George" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, October 29, 2002 1:50 PM
Subject: [DUG]: Headache material


> Hi all.
> I am having a problem with tmemo in that if I delete one item in the loop
below
> the memo is stuffed afterwards. But in the second example memo is OK. Any
tips??
> Logically, memo count is adjusted after one item deleted but tval is inc'd
for next.
> Tval needs to be dec'd prior to next count (I think) but you cant do that!
>
>   for tval := 0 to memo1.Lines.Count - 1 do
>   begin
>     with memo1.Lines do
>     begin
>       if (directoryexists(strings[tval])) then //its DEFINITELY a
directory
>         if not dirhasfile(strings[tval]) then delete(tval)
>         else
>           strings[tval] := IncludeTrailingBackSlash(strings[tval]) +
'*.*';
>     end;
>   end;
>
>
> This works:
>   counter:integer;
>
>   for tval := 0 to memo1.Lines.Count - 1 do
>   begin
>     with memo1.Lines do
>     begin
>       if (directoryexists(strings[tval])) then //its DEFINITELY a
directory
>         if not dirhasfile(strings[tval]) then counter:=tval
>         else
>           strings[tval] := IncludeTrailingBackSlash(strings[tval]) +
'*.*';
>     end;
>   end;
> memo1.lines.delete(counter); //FINE FOR ONE INSTANCE ONLY!
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to