Re: How to transfer a text file into DBGrid?
Posted by webmaster Guido on April 05, 2003 at 13:20:35:
In Reply to: How to transfer a text file into DBGrid? posted by sam sgling07 on April 04, 19103 at 15:23:37:
: Thanks for help.
The easiest way to do this:
Let's assume that you use a TTable component Table1 to receive the textlines, and Table1 has a field called Textline that's large enough to hold the longest line of text.
procedure TForm1.AppendTxtToTable(TxtFile: string); var i: integer; SL: TStringList; begin SL := TStringList.Create; SL.LoadFromFile(TxtFile); for i := 0 to SL.Count - 1 do begin Table1.Append; Table1TextLine.Value := SL[i]; Table1.Post; end; SL.Free; end;