{Start SynEditMEMO} i := 0; if GroupNameEdit.Text <> '' then begin repeat begin SynMEMO1.Lines.Strings[i] := '<a href="' + BaseURLEdit.Text + BaseFolderEdit.Text + ImagesLBX.Items[i] + '" ' + 'rel=' + '"' + GroupNameEdit.Text + '"' + '><img src="' + BaseURLEdit.Text + BaseFolderEdit.Text + ThumbsFolderEdit.Text + ThumbnailPrefixEdit.Text + ImagesLBX.Items[i] + '"></a>'; i := i + 1; end until i = ImagesLBX.Count; {10th Dec 09 - removed -1} end else begin repeat begin SynMEMO1.Lines.Strings[i] := '<a href="' + BaseURLEdit.Text + BaseFolderEdit.Text + ImagesLBX.Items[i] + '" ' + 'rel="lightbox"' + '><img src="' + BaseURLEdit.Text + BaseFolderEdit.Text + ThumbsFolderEdit.Text + ThumbnailPrefixEdit.Text + ImagesLBX.Items[i] + '"></a>'; i := i + 1; end until i = ImagesLBX.Count; {10th Dec 09 - removed -1} end;
Indeed you need to do the i:=i+1 in a repeat...until (you wouldn't in a for).You just need to put until i = ImagesLBX.Count - 1(i don't know why you removed it ?!)
It should be SynMEMO1.Linesinstead of SynMEMO1.Lines.StringsBut even this will fail.SynEdit doesn't auto add new lines. (except for an empty synedit, allows access to lines[0], IIRC)Check Lines.Count, and use Lines.Add, if needed