Code Error - help! lazarus / 8-Other ---------------------------------------------------------------------- MisterKode · 2008-11-20 13:38 Hi everyone I've got some code that grabs items from a list box and combines it with a whole lot of Editbox strings and put them into a Memo; have got it partly working, however it only outputs the FIRST item to the memo. and none after that. Here's the code: Code: [Select]with GeneratedCodeSYNEDIT.Lines do // just for shorter typing     for i:=0 to Count-1 do       Strings[i]:=''; Can anyone see what I'm doing wrong? Thanks Carl ---------------------------------------------------------------------- Vincent Snijders · 2008-11-20 21:26 What is GeneratedCodeSYNEDIT.Lines.Count? Maybe you should loop until ImagesLBX.Count-1. ---------------------------------------------------------------------- theo · 2008-11-20 21:51 Don't use "with" statements. They are prone to error. ---------------------------------------------------------------------- MisterKode · 2008-11-21 01:37 Thanks, I'll modify this code and if I have any more problems I'll post back in this thread ---------------------------------------------------------------------- MisterKode · 2008-12-01 08:38 I tried a REPEAT statement as below, but it's locking the whole program - any suggestions would be appreciated please Code: [Select]procedure TBoxCodeGeneratorFORM.GenerateCodeBITBTNClick(Sender: TObject); {Generate HTML Code}   var   i: integer; begin   if GroupNameEdit.Text <> '' THEN   Begin     REPEAT       GeneratedCodeSYNEDIT.Lines.Strings[i]:=''     UNTIL i= ImagesLBX.Count-1;   End   Else   Begin     REPEAT       GeneratedCodeSYNEDIT.Lines.Strings[i]:=''     UNTIL i= ImagesLBX.Count-1;   End; end; ---------------------------------------------------------------------- JanRoza · 2008-12-01 08:57 I quickly glanced thru your Repeat loops, but they will never stop. Where do you increase the value of i? I think now your loops will endlessly perform the operation on the same item. Simplest form of a repeat loop: Code: [Select] i := 0; repeat     i := i + 1; until i = .........   Jan ---------------------------------------------------------------------- MisterKode · 2008-12-01 11:48 Thanks so much Jan, got it working on a normal TMemo, but on a SynMemo it comes up with a runtime out-of-bounds error Will just stick to the TMemo for now.