Autor Beitrag
drummer83
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Di 03.04.07 22:44 
Hallo,

ich bekomme folgende Fehlermeldung:
'Missing operator or semicolon' bei folgendem Code in Zeile 8:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var
  bla: TextFile;
  Test: ShortString;
begin
 AssignFile(bla, dateiname);
 FileMode := fmOpenRead;
 Reset(bla);
 Readln(bla,Test);
 Memo2.Lines.Add('Test');
end;


Das seltsame ist halt, dass ich den Fehler nur in meinem gesamten Projekt bekomme und nicht, wenn ich ein neues Projekt erstelle, in dem es nur diese Prozedur gibt. Aber was kann denn in meinem anderen Quelltext dazu führen, dass ich genau an dieser Stelle den Fehler bekomme? Ich versteh das einfach nicht.

Ich hoffe jemand kann mir helfen und danke schon mal im voraus.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 03.04.07 22:51 
Moin und :welcome: im Forum!

Schau mal, ob du das nicht vielleicht lieber anders lösen kannst/möchtest :arrow: Suche in: Delphi-Forum, Delphi-Library LOADFROMFILE

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
drummer83 Threadstarter
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Mi 04.04.07 14:50 
Ok, danke. Damit hab ich es hinbekommen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormCreate(Sender: TObject);
var
  fileData: TStringList;
begin
  fileData := TStringList.Create;
  fileData.LoadFromFile(dateiname);
  for i:=1 to AnzahlDerTeams do
    (FindComponent('ComboBox'+IntToStr(i)) as TComboBox).ItemIndex:=StrToInt(fileData[i-1]);
end;
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 04.04.07 14:53 
Moin!

Du solltest aber das dynamische Objekt auch wieder freigeben :mahn: am besten mit einem Resourceschutzblock: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.FormCreate(Sender: TObject);  
var  
  fileData: TStringList;  
begin  
  fileData := TStringList.Create;  
  try
    fileData.LoadFromFile(dateiname);  
    for i:=1 to AnzahlDerTeams do  
      (FindComponent('ComboBox'+IntToStr(i)) as TComboBox).ItemIndex:=StrToInt(fileData[i-1]);  
  finally
    fileData.Free;
  end;

end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.