All pastes #57367 Raw Edit

Untitled

public text v1 · immutable
#57367 ·published 2006-05-20 21:41 UTC
rendered paste body
procedure TForm1.Open_ActionExecute(Sender: TObject);
var s:char;
    i:integer;
    TmpStringList: TStringList;

begin
  if OpenDialog1.Execute then
  begin
    i := 1;

    TmpStringList := TStringList.Create;

    AssignFile(fopen, OpenDialog1.FileName);
    Reset(fopen);
    try
      while not SeekEof(fopen) do
      begin
        ReadLn(fopen, s);

        TmpStringList.CommaText := s;

        StringGrid1.RowCount := i + 1;

        StringGrid1.Rows[i].Assign(TmpStringList);

        if i > StringGrid1.Row then StringGrid1.RowCount:=StringGrid1.RowCount+1;

        Inc(i);
      end;
    finally
      TmpStringList.Free;
      CloseFile(fopen);
    end;
  end;
end;

the file

1,23423,100
2,25674,100
3,12356,150
4,34523,150
5,12674,200
6,45673,200
7,45678,250
8,42213,300

current output is 1,2,3,4,5,6,7,8 in seperate rows,

would like to see something like StringGrid.Cells[0,1]:='1'; StringGrid.Cells[1,1]:='23423'; StringGrid.Cells[2,1]:='100';
9,12456,350