Hallo zusammen,
ich sitze vor folgendem Problem: Verschiedene Profile sollen in einer Ini gespeichert, bzw. geladen werden (in eine ListBox).
Für das Speichern in der Ini habe ich folgenden Code, der auch funktioniert:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
| procedure TForm1.Button1Click(Sender: TObject); var i:integer; s:string; ini: TIniFile; begin ini:=TIniFile.Create('config.ini'); try for i:=0 to ListBox1.Items.Count-1 do begin s:='Profil'+IntToStr(i+1); ini.WriteString('Profile',s,ListBox1.Items[i]); end; finally ini.free; end; end; |
Nun steht in der config.ini z.B.:
[Profile]
Profil1=a
Profil2=b
Profil3=c
Jetzt kommt das eigentliche Problem:
Wie kann ich es machen, dass die Ini in die ListBox kommt, praktisch die umgekehrte Richtung?
So etwas in der Art
Delphi-Quelltext
1: 2: 3: 4: 5:
| for i:=1 to begin a:=ini.ReadString('Profile',Profil[i],'non'); ListBox1.Items.Add(a); end; |
Viele liebe Grüße
Kri