Read all section .ini values into stringgrid
<p>I use Delphi XE7. Is there any way to load all values from an .ini file into a stringgrid in different coloumns?</p>

<p>My .ini file looks like</p>

<pre>
[1038]
AValue = a1 
BValue = b1
CValue = c1
DValue = d1

[1031]
AValue = a2 
BValue = b2
CValue = c2
DValue = d2
</pre>

<p>I use this procedure for filling the grid:</p>

<pre><code>procedure TForm1.ReadIntoGrid(const aIniFileName, aSection: string;
const aGrid: TStringGrid);
var
  Ini: TIniFile;
  SL: TStringList;
  i: Integer;
begin
  SL := TStringList.Create;
  try
    Ini := TIniFile.Create(aIniFileName);
    try
      aGrid.ColCount := 2;
      Ini.ReadSectionValues(aSection, SL);
      aGrid.RowCount := SL.Count;

      for i := 0 to SL.Count - 1 do
      begin
        aGrid.Cells[0,i] := SL.Names[i];
        aGrid.Cells[1,i] := SL.ValueFromIndex[i];
      end;
    finally
      Ini.Free;
    end;
  finally
    SL.Free;
  end;
end;
</code></pre>

<p>It works fine, I get this:</p>

<p><a href="https://i.stack.imgur.com/4G6Vo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4G6Vo.jpg" alt="enter image description here"></a></p>

<p>My question is...<br />
How can I read all section values (1038 and 1031) into the grid next to the 1038 values? Values will be fixed all time.</p>

<p><a href="https://i.stack.imgur.com/dWdD9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dWdD9.png" alt="enter image description here"></a></p>