Einzelnen Beitrag anzeigen

JimmyB

Registriert seit: 20. Mär 2022
26 Beiträge
 
#1

Habe ich Knöpfe auf den Augen - Please help

  Alt 17. Apr 2022, 21:42
Hallo Leute,

ich werde wahnsinnig. Ein einfacher Code, aber bekomme einen Fehler und weiß nicht woran es liegt. Beim Starten kommt die Meldung bei 10.4
[dcc32 Fehler] Unit3.pas(53): E2003 Undeklarierter Bezeichner: 'redDisplay'
[dcc32 Fehler] Unit3.pas(53): E2066 Operator oder Semikolon fehlt
[dcc32 Fataler Fehler] Project2.dpr(5): F2063 Verwendete Unit 'Unit3.pas' kann nicht compiliert werden
Misslungen
Verstrichene Zeit: 00:00:00.5

vg JimmyB


unit Unit3;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls;

type
TForm3 = class(TForm)
Button1: TButton;
Button2: TButton;
RichEdit1: TRichEdit;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;

var
Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
// Step 1 - Declare Variables
var myfile : textfile;
sLine : string;

begin
// Step 2 - check if filename exist
if FileExists( 'teams.txt' ) = FALSE then
begin
showmessage('Datei nicht gefunden') ;
exit;
end;
showmessage('Die Datei ist vorhanden') ;
// Step 3 - Assign File to our variable
AssignFile( myfile, 'teams.txt');

//Step 4: Put the pointer to the top of the textfile
Reset( myfile );

//Step 5: Loop through our textfile
//You must use BEGIN and END
while NOT eof(myfile) do
begin
//Step 6: Get each line of text file into string varibale
readln(myfile , sLine);
redDisplay.Lines.Add( sLine) ;

end; //end of our while loop

//Step 7: Close the association with the text file
closefile (myfile);

end;

end.
  Mit Zitat antworten Zitat