(Gast)
n/a Beiträge
|
Re: Exeption - Woher?
18. Aug 2008, 23:42
muss nicht, nur schnell reingehackt...
so, besser?
Delphi-Quellcode:
UNIT Unit1;
INTERFACE
USES
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, csv;
TYPE
TForm1 = CLASS(TForm)
sg: TStringGrid;
PROCEDURE FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
END;
VAR
Form1: TForm1;
IMPLEMENTATION
{$R *.dfm}
PROCEDURE TForm1.FormCreate(Sender: TObject);
VAR
csv: tCSV;
i: integer;
j: integer;
sl: TStringList;
BEGIN
sl := TStringList.Create;
TRY
sl.LoadFromFile(' Buecher.txt');
csv := tCSV.Create;
TRY
sg.ColCount := 8;
sg.RowCount := sl.Count + 1;
FOR i := 0 TO sl.Count - 1 DO
BEGIN
csv.Analyze(sl.Strings[i]);
sg.Cells[0, i + 1] := IntToStr(i + 1);
FOR j := 0 TO csv.Count - 1 DO
sg.Cells[j + 1, i + 1] := csv.Columns[j];
END;
FINALLY
csv.Free;
END;
FINALLY
sl.Free;
END;
END;
END.
|
|
Zitat
|