Hi,

--On Tuesday, October 29, 2002 13:50:59 +1300 Alistair George <[EMAIL PROTECTED]> wrote:

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;
I would go out on a limb and suggest useing a while loop instead of a for loop. You can continue looping until memo1.lines.count is empty that way and not have to worry about how many lines there actually are.

My $0.00002 worth.

cheers

Glen Boyd <[EMAIL PROTECTED]>
Network Administrator Napier City Council
Private Bag 6010, Napier, NEW ZEALAND
Phone: +64-6-8344119 Fax: +64-6-8357574


######################################################################
Attention: This e-mail message and accompanying data may contain information that is confidential and subject to legal privilege. Any information
provided is given in good faith. However unless specifically stated
to the contrary, Napier City Council accepts no liability for the
content of this e-mail or for the consequences of any action taken on
the basis of the information provided, unless that information is
subsequently confirmed in writing. If you are not the intended recipient,
you are notified that any use, dissemination, distribution or copying
of this message or data is prohibited. If you received this e-mail
message in error, please notify us immediately and erase all copies
of this message and attachments. Thank you.
######################################################################
---------------------------------------------------------------------------
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