Autor Beitrag
beljo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Sa 11.03.06 14:56 
hallo Leute
hab folgendes versucht.
Textfelder in eine Datei ablegen und wieder in die Textfelder Laden. Dies habe ich nach Gaussis Vorschlag mit Ini-Files realisert.
hier mein Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Button1Click(Sender: TObject);
begin
if savedialog1.execute then
 begin
   ini := TIniFile.create(SaveDialog1.Filename);
   ini.writeString('MeineWerte','Spannung1',Edit1.text);
   ini.free;
 end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.execute then
 begin
  ini :=TiniFile.;
  ini.ReadString('MeineWerte','Spannung1',Edit1.text);
  ini.free;
end;
end;

Ich habe mit TIniFile anstatt mit TMemIniFile gearbietet, weil ich das nicht in uses deklarieren konnte.
Das Einlesen funktioniert einwandfrei.Leider geht das Auslesen aus der Datei in das Textfeld nicht.(Keine Fehlermeldung)
Wo ist der Fehler in der Methode Button2Click?
vielen Dank im Vorraus Leute
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 11.03.06 15:02 
So muss es heißen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if opendialog1.execute then
 begin
  ini :=TiniFile.create(opendialog1.filename);
  ini.ReadString('MeineWerte','Spannung1',Edit1.text);
  ini.free;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
beljo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Sa 11.03.06 15:16 
Nett gemeint Marco aber beim kopieren hab ich geschlammt.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Button1Click(Sender: TObject);
begin
if savedialog1.execute then
 begin
   ini := TIniFile.create(SaveDialog1.Filename);
   ini.writeString('MeineWerte','Spannung1',Edit1.text);
   ini.free;
 end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.execute then
 begin
  ini :=TiniFile.Create(opendialog1.filename);
  ini.ReadString('MeineWerte','Spannung1',Edit1.text);
  ini.free;
end;
end;

Hatte den Teil den Du geschrieben hast ausversehen ausgelassen.
So funktioniert es auch nicht Problem bleibt das selbe wie am Anfang
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 11.03.06 15:20 
Ah na gut ;)
Also:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.execute then
 begin
  ini :=TiniFile.Create(opendialog1.filename);
  edit1.text:=ini.ReadString('MeineWerte','Spannung1',Edit1.text);
  ini.free;
end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
beljo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Sa 11.03.06 15:53 
Super hat funktioniert :-)
wundere mich wie ich soooooooo einen DUMMENEN Fehler machen konnte hätte bestimmt noch Tage gegrübelt ;-)
nochmals Vielen Vielen Dank Marco
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 11.03.06 16:09 
user profile iconbeljo hat folgendes geschrieben:
wundere mich wie ich soooooooo einen DUMMENEN Fehler machen konnte hätte bestimmt noch Tage gegrübelt ;-)

Das gleiche Problem hatte ich auch einmal. Und aus Fehlern lernt man ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot