Autor Beitrag
MaximusMR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Di 02.07.02 18:25 
Ich habe ein kleines Programm geschreiben in dem man einen kleinen Text Speichern kann und später wieder Laden. Nur hinter dem Text der aus der Datei geladen wird sind 2 Striche .
Warum???
Und wie kann ich sie vermeiden?
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 02.07.02 19:14 
Poste doch mal den Code (Speichern und Laden). Dann können wir bestimmt besser helfen :-D

Gruß
MaximusMR Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Di 02.07.02 19:43 
Ihr braucht nur 2 Buttons und ein edit Feld.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button1Click(Sender: TObject);
var
 LB:TStringList;
begin
 LB:=TStringList.Create;
 LB.Add(edit2.text);
 LB.SaveToFile('Saves.txt');
 LB.Free;
 edit2.Text:='';
end;

procedure TForm1.Button2Click(Sender: TObject);
var
 LB:TStringList;
begin
 LB:=TStringList.Create;
 LB.LoadFromFile('Saves.txt');
 edit2.Text:=LB.text;
end;


Code-Tag hinzugefügt. Marc
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Di 02.07.02 20:11 


Zuletzt bearbeitet von Pit am Sa 05.10.02 06:36, insgesamt 1-mal bearbeitet
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 03.07.02 10:13 
Das heißt die Button2 (Also das Laden) müsste so aussehen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button2Click(Sender: TObject); 
var 
  LB:TStringList; 
begin 
  LB:=TStringList.Create; 
  LB.LoadFromFile('Saves.txt'); 
  If LB.Count > 0 Then
    edit2.Text:=LB [0]; 
  LB.Free;
end;


Gruß
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Mi 03.07.02 13:07 


Zuletzt bearbeitet von Pit am Sa 05.10.02 06:36, insgesamt 1-mal bearbeitet
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 03.07.02 14:26 
@Pit: Kurz und knapp: Verstehe Dein Posting nicht :roll:
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Mi 03.07.02 14:28 


Zuletzt bearbeitet von Pit am Sa 05.10.02 06:36, insgesamt 1-mal bearbeitet
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 03.07.02 14:32 
Ach so: Du meinst den Try-Finally-Block. Na ja! Ich hab diese Anweisungen noch nie so oft benutzt. Ob ich deshalb bei Dir nicht zu den ernstzunehmenden Delphi-Programmiere zähle ist mir eigentlich gleich :-D