🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11510

Strange bug...reversing a stringlist and than inserting a linenumber (endless loop)

#11510
From: (Oren)
Date: Fri, 06 Feb 2004 12:18
38 lines
2187 bytes
hi dear builders,

can someone help me with optimizing the below code...?
when I first reverse the content of Memo via this:

/***************************************************************/
void __fastcall TfrmStringDetails::cmdText_ReverseClick(TObject *Sender)
{
   AnsiString temp = Memo1->Text;
   strrev(temp.c_str());
   Application->ProcessMessages();
   Memo1->Text = temp;
}
/***************************************************************/

and than insert a line number for each line with this:

/***************************************************************/
void __fastcall TfrmStringDetails::cmdLine_NumbersClick(TObject *Sender)
{
  for(int i = 0; i < Memo1->Lines->Count; i++)
  {
    Memo1->Lines->Strings[i] = String(i + 1) + ".) " +
Memo1->Lines->Strings[i];
    int LineCount = Memo1->Lines->Count;
    Memo1->Lines->Strings[i] = Memo1->Lines->Strings[i] + "\r\n";
    if(Memo1->Lines->Count > LineCount)
    Memo1->Lines->Delete(i + 1);
  }
}
/***************************************************************/

my programm want stop to insert the line numbers...(endless loop...) but why
??
can someone help and take a look on the code...?


Oren
Technical Details
Message-ID: <40238620$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,93c18e6afff6855b,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-06 04:39:43 PST
Reply-To: "\(Oren\)" <Oren.Avni@REMOVE_MExq11.com>
From: "\(Oren\)" <Oren.Avni@REMOVE_MExq11.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Strange bug...reversing a stringlist and than inserting a linenumber (endless loop)
Date: Fri, 6 Feb 2004 13:18:43 +0100
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2727.1300
NNTP-Posting-Host: 217.234.69.63
Message-ID: <40238620$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076069920 217.234.69.63 (6 Feb 2004 04:18:40 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail