Autor Beitrag
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Di 27.01.04 14:45 
hallo ich will das in edit1 section drine steht
und das in edit2 eine name steht und in edit3 ein password

wie kann ich das speichern und laden.

Chris (Delphi7)
Erzengel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 99

Win 2000, WinXP
Delphi 5 Enterprise
BeitragVerfasst: Di 27.01.04 14:53 
Speichern:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var i: integer;
      s: TStringList;
begin
try
 s:= TStringList.Create;
 for i:=0 to 5 do // für 5 die Anzahl der Edits nehmen
     s.Add((FindComponent('Edit' + IntToStr(i)) as TEdit).Text);
 s.SaveToFile('udix.spp');
finally
 s.Free;


 end;
 close;
end;


Laden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var i: integer;
      s: TStringList;
begin
try

 s:= TStringList.Create;
 s.LoadFromFile('udix.spp');
 for i:=0 to 5 do // für 5 die Anzahl der Edits nehmen
     (FindComponent('Edit' + IntToStr(i)) as TEdit).Text := s[i];
finally
 s.Free;
end;
end;

_________________
Ein Kreis ist ein rundes Quadrat
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Di 27.01.04 14:55 
Hi,


was du suchst ist ein TIniFile.

Am leichtesten gehts ~ so :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
 MyIni : TIniFile;
begin
 MyIni := TIniFile.Create('c:\test.ini');
 MyIni.ReadString('Section','Schlüssel','Defaultwert');
 MyIni.WriteString('Sektion','Schlüssel','Wert!');
end;


Mehr dazu steht in der OH.
waldmeister
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

Win XP
D7 Enterp
BeitragVerfasst: Di 27.01.04 14:55 
hätte nie gedacht dass ich das selber mal sagen, aber:

Suchfunktion is ganz was tolles :)

da stößt man z.B. auf folgendes Tutorial:

Ini-Dateien

hoffe das hilft dir weiter!

_________________
der wald....der meister....der meister des waldes....der waldmeister
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Di 27.01.04 19:05 
hallo Erzengel aber das mit dem laden geht nicht

Chris (Delhpi7)
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Di 27.01.04 19:08 
HI,

das es Erzengel da beschrieben hat, hat nichts mit ini Dateien zutun!
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 27.01.04 19:37 
@BungeeBug:
ausblenden Delphi-Quelltext
1:
MyIni.WriteString('Sektion','Schlüssel','Wert!');					

Wo landet denn bei dir der Wert der ausgelesen wird? :mrgreen:
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Di 27.01.04 20:24 
Luckie hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
MyIni.WriteString('Sektion','Schlüssel','Wert!');					

Wo landet denn bei dir der Wert der ausgelesen wird? :mrgreen:


Da wird nichts gelesen :mrgreen:

Zitat:
ausblenden Delphi-Quelltext
1:
MyIni.ReadString('Section','Schlüssel','Defaultwert');					


Aber wo Landet das Ergebnis da? :angel: [/delphi]
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 27.01.04 21:49 
Mist, das meinte ich natürlich. :oops:
Erzengel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 99

Win 2000, WinXP
Delphi 5 Enterprise
BeitragVerfasst: Mi 28.01.04 07:52 
Also bei mir funzt das sehr gut.
Ok du must dann stadt .spp dann .ini schreiben aber das ist ja egal.
Kleiner Tipp. Versuch mal schon vorher die datei anzulegen.

_________________
Ein Kreis ist ein rundes Quadrat