![]() |
Fehler beim Speichern
Hallo zusammen
Habe folgenden fehler beim Speichern des inhaltes meiner Combobox Zitat:
An Folgender Stelle was habe ich Falsch gemacht :gruebel:
Delphi-Quellcode:
Danke schon mal
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; |
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. (?) |
Re: Fehler beim Speichern
Es reicht wenn du statt s := ReadLN(f,s); ReadLN(f,s); schreibst da ReadLN eine Prozedur ist.
![]() |
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; |
Re: Fehler beim Speichern
Zitat:
|
Re: Fehler beim Speichern
Delphi-Quellcode:
endet in sowas wie "F:\Sources\foo\C:" - und weiter muss ich garnich schreiben. ":" ist ein Pfaden explizit verboten.
ExtractFilePath(ParamStr(0)) +'C:\Datei\Lehrereinträge.txt'
|
Re: Fehler beim Speichern
Misst, schneller ;-)
alternativ ginge noch "ExtractFilePath(ParamStr(0)) +'Lehrereinträge.txt'" falls die datei im ordner des programmes ist... |
Re: Fehler beim Speichern
Danke Funktioniert ohne dem
Delphi-Quellcode:
es langt wenn ich den Kompletten Pfad eingebe
"ExtractFilePath(ParamStr(0)) +'Lehrereinträge.txt'"
Danke :lol: |
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.
|
Re: Fehler beim Speichern
Dann habe ich den E/A Fehler aber wieder :gruebel:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz