[Solved]TStringGrid EGridException index out of range. lazarus / 31-LCL ---------------------------------------------------------------------- cov · 2025-09-29 08:26 I'm probably doing something really, really stupid. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   fpaths:=TStringList.Create;  fpaths.Delimiter:=';';  fpaths.StrictDelimiter:=True;  fpaths.DelimitedText:=INI.ReadString('Font paths','paths','');  StringGrid1.Width:=GroupBox1.Width-16;  for i:=0 to fpaths.Count-1 do  begin    if fpaths.Strings[i]<>'' then      StringGrid1.InsertRowWithValues(n,[fpaths.Strings[i]]);  end;                                                           Can anyone advise me what it is? I've tried setting the rowCount to 1 and clearing it with TStringGrid.Clear. ---------------------------------------------------------------------- Lutz Mändle · 2025-09-29 08:43 Where is n from in Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     StringGrid1.InsertRowWithValues(n,[fpaths.Strings[i]]);  I guess, it should be i. ---------------------------------------------------------------------- Zvoni · 2025-09-29 08:54 *sigh* Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for i:=0 to fpaths.Count-1 do  //You are using "i" as iterator  begin    if fpaths.Strings[i]<>'' then      StringGrid1.InsertRowWithValues(n,[fpaths.Strings[i]]);  //You are using "n" as Row-Identifier  end;          Spot the mistake EDIT: Why even in such a convoluted way with that InsertRowWithValues? Why not read the INI-Stuff into a FileStream, and then use LoadFromCSVStream? https://lazarus-ccr.sourceforge.io/docs/lcl/grids/tcustomstringgrid.lo adfromcsvstream.html ---------------------------------------------------------------------- cov · 2025-09-29 09:41 Thanks, Well spotted. Yes the 'n' was a legacy item in my code that I hadn't noticed. The reason that I'm loading from an INI file is that I have multiple items and the Font paths are just one of them.