Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Fehler beim Speichern (https://www.delphipraxis.net/83517-fehler-beim-speichern.html)

SaFu 3. Jan 2007 23:39


Fehler beim Speichern
 
Hallo zusammen

Habe folgenden fehler beim Speichern des inhaltes meiner Combobox

Zitat:

Fehler] Unit7.pas(105): Inkompatible Typen: 'String' und 'procedure, untyped pointer or untyped parameter'

An Folgender Stelle was habe ich Falsch gemacht :gruebel:


Delphi-Quellcode:
procedure TForm7.FormCreate(Sender: TObject); // Zellenbeschriftung

var i: integer;
    f: TextFile;
    s: String;
begin
  begin
AssignFile(f, ExtractFilePath(ParamStr(0)) +'C:\Datei\Lehrereinträge.txt');

Reset(f);

while EOF(f) = false do
  begin
   s:= Readln(f,s);   // Hier ist der FEHLER
   Combobox3.Items.Add(s);
  end;

CLosefile(f);
end;


  for i:=0 to ComponentCount-1 do // XP Anzeige
  if Components[i] is TPanel then (Components[i] as TPanel).ParentBackground:=false;
  Label1.Caption := 'An Koll. ';
  Label2.Caption:= DateToStr(Date);
  Label3.Caption := 'VERTRETUNGSPLAN für Koll. ';
  Label8.Caption:= 'Kalenderwoche: ';
  Label14.Caption:= 'Woche ';
  Stringgrid1.Visible:= True;
  StringGrid1.Cells[0,0]:= 'Wochentag';
  StringGrid1.Cells[0,1]:= 'Montag';
  StringGrid1.Cells[0,5]:= 'Dienstag';
  StringGrid1.Cells[0,9]:= 'Mittwoch';
  StringGrid1.Cells[0,13]:= 'Donnerstag';
  StringGrid1.Cells[0,17]:= 'Freitag';
  StringGrid1.Cells[0,21]:= 'Samstag';
  StringGrid1.Cells[1,0]:= 'Klasse';
  StringGrid1.Cells[2,0]:= '1';
  StringGrid1.Cells[3,0]:= '2';
  StringGrid1.Cells[4,0]:= '3';
  StringGrid1.Cells[5,0]:= '4';
  StringGrid1.Cells[6,0]:= '5';
  StringGrid1.Cells[7,0]:= '6';
  StringGrid1.Cells[8,0]:= ' ';
  StringGrid1.Cells[9,0]:= '7';
  StringGrid1.Cells[10,0]:= '8';
end;
Danke schon mal

kaiser1401 3. Jan 2007 23:47

Re: Fehler beim Speichern
 
mir scheint, kann grad nicht nachschauen, als ob readln keine funktion ist sondern eine prozedur (ohne rückgabewert)
lass doch mal das s:= weg. (?)

EDatabaseError 3. Jan 2007 23:48

Re: Fehler beim Speichern
 
Es reicht wenn du statt s := ReadLN(f,s); ReadLN(f,s); schreibst da ReadLN eine Prozedur ist.

Delphi-Referenz durchsuchenReadLN

SaFu 3. Jan 2007 23:53

Re: Fehler beim Speichern
 
Jetzt habe ich den E/A Fehler 123

Delphi-Quellcode:
procedure TForm7.FormCreate(Sender: TObject); // Zellenbeschriftung
var i: integer;
    f: TextFile;
    s: String;
begin
   begin
AssignFile(f, ExtractFilePath(ParamStr(0)) +'C:\Datei\Lehrereinträge.txt');

Reset(f);   // Hier ist jetzt der FEHLER

while EOF(f) = False do
  begin
   {s:=} Readln(f,s);  
   Combobox3.Items.Add(s);
  end;

Closefile(f);
 end;


  for i:=0 to ComponentCount-1 do // XP Anzeige
  if Components[i] is TPanel then (Components[i] as TPanel).ParentBackground:= False;
  Label1.Caption := 'An Koll. ';
  Label2.Caption:= DateToStr(Date);
  Label3.Caption := 'VERTRETUNGSPLAN für Koll. ';
  Label8.Caption:= 'Kalenderwoche: ';
  Label14.Caption:= 'Woche ';
  StringGrid1.Cells[0,0]:= 'Wochentag';
  StringGrid1.Cells[0,1]:= 'Montag';
  StringGrid1.Cells[0,5]:= 'Dienstag';
  StringGrid1.Cells[0,9]:= 'Mittwoch';
  StringGrid1.Cells[0,13]:= 'Donnerstag';
  StringGrid1.Cells[0,17]:= 'Freitag';
  StringGrid1.Cells[0,21]:= 'Samstag';
  StringGrid1.Cells[1,0]:= 'Klasse';
  StringGrid1.Cells[2,0]:= '1';
  StringGrid1.Cells[3,0]:= '2';
  StringGrid1.Cells[4,0]:= '3';
  StringGrid1.Cells[5,0]:= '4';
  StringGrid1.Cells[6,0]:= '5';
  StringGrid1.Cells[7,0]:= '6';
  StringGrid1.Cells[8,0]:= ' ';
  StringGrid1.Cells[9,0]:= '7';
  StringGrid1.Cells[10,0]:= '8';
end;

EDatabaseError 3. Jan 2007 23:58

Re: Fehler beim Speichern
 
Zitat:

Zitat von fuknersascha
Jetzt habe ich den E/A Fehler 123

Delphi-Quellcode:
procedure TForm7.FormCreate(Sender: TObject); // Zellenbeschriftung
var i: integer;
    f: TextFile;
    s: String;
begin
   begin
AssignFile(f, 'C:\Datei\Lehrereinträge.txt');

Reset(f);   // Hier ist jetzt der FEHLER

while EOF(f) = False do
  begin
   {s:=} Readln(f,s);  
   Combobox3.Items.Add(s);
  end;

Closefile(f);
 end;


  for i:=0 to ComponentCount-1 do // XP Anzeige
  if Components[i] is TPanel then (Components[i] as TPanel).ParentBackground:= False;
  Label1.Caption := 'An Koll. ';
  Label2.Caption:= DateToStr(Date);
  Label3.Caption := 'VERTRETUNGSPLAN für Koll. ';
  Label8.Caption:= 'Kalenderwoche: ';
  Label14.Caption:= 'Woche ';
  StringGrid1.Cells[0,0]:= 'Wochentag';
  StringGrid1.Cells[0,1]:= 'Montag';
  StringGrid1.Cells[0,5]:= 'Dienstag';
  StringGrid1.Cells[0,9]:= 'Mittwoch';
  StringGrid1.Cells[0,13]:= 'Donnerstag';
  StringGrid1.Cells[0,17]:= 'Freitag';
  StringGrid1.Cells[0,21]:= 'Samstag';
  StringGrid1.Cells[1,0]:= 'Klasse';
  StringGrid1.Cells[2,0]:= '1';
  StringGrid1.Cells[3,0]:= '2';
  StringGrid1.Cells[4,0]:= '3';
  StringGrid1.Cells[5,0]:= '4';
  StringGrid1.Cells[6,0]:= '5';
  StringGrid1.Cells[7,0]:= '6';
  StringGrid1.Cells[8,0]:= ' ';
  StringGrid1.Cells[9,0]:= '7';
  StringGrid1.Cells[10,0]:= '8';
end;

den pfad gabs nicht ich habs im zitat geändert probiers mal so...

Dax 3. Jan 2007 23:59

Re: Fehler beim Speichern
 
Delphi-Quellcode:
ExtractFilePath(ParamStr(0)) +'C:\Datei\Lehrereinträge.txt'
endet in sowas wie "F:\Sources\foo\C:" - und weiter muss ich garnich schreiben. ":" ist ein Pfaden explizit verboten.

kaiser1401 4. Jan 2007 00:00

Re: Fehler beim Speichern
 
Misst, schneller ;-)
alternativ ginge noch

"ExtractFilePath(ParamStr(0)) +'Lehrereinträge.txt'"

falls die datei im ordner des programmes ist...

SaFu 4. Jan 2007 00:05

Re: Fehler beim Speichern
 
Danke Funktioniert ohne dem

Delphi-Quellcode:
"ExtractFilePath(ParamStr(0)) +'Lehrereinträge.txt'"
es langt wenn ich den Kompletten Pfad eingebe



Danke :lol:

kaiser1401 4. Jan 2007 00:08

Re: Fehler beim Speichern
 
es wäre damit nur flexibler da du dann nicht im code was ändern musst wenn es an einer anderen stelle installiert ist.

SaFu 4. Jan 2007 00:17

Re: Fehler beim Speichern
 
Dann habe ich den E/A Fehler aber wieder :gruebel:


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:20 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz