Working with Timer Guage Date and Printer Text in Delphi

 Timer and Gauge
 Date
 Send Text file to Printer

{ print button OnClick event handler }

procedure TForm1.Button4Click(Sender: TObject);

var

    LineCounter : integer;

    PrintText : system.text;

    FileString : TStringList;

begin


{ display print dialog - if the user cancels, get out }

{ not using any dialog settings - it just for show     }

    if not printdialog1.Execute then

     exit;


    { create a TStringList }

    FileString := TStringList.create;

  try

     { load the current text file }

     filestring.LoadFromFile(Filelistbox1.Name);


    { assign the standard text file to the printer }

    AssignPrn(PrintText);


    { open the std. file for printing }

    Rewrite(PrintText);


   { loop thru lines and write each one }

   { TStringList is an array, you will need and index counter Count property determines the total size or the total number of line(s) in the current TStringList }

   for LineCounter := 0 to FileString.Count - 1 do

       writeln(PrintText, FileString.Strings[LineCounter]);


  finally

  { close the std. text file and free the TStringList variable from the memory and will be executed regardless if the result of this TRY.....Finally.....End statement

    is OK or not }

        system.Close(PrintText);

        FileString.free;

  end;

end;


{ This code prints a line of text on the printer when the user clicks the button on the form: }

procedure TForm1.Button1Click(Sender: TObject);

var

   MyFile: TextFile;

begin

    AssignPrn(MyFile);

    Rewrite(MyFile);

    Writeln(MyFile, 'Print this text');

    System.CloseFile(MyFile);

end;