Du solltest deine Controls umbenennen, zumindest die wichtigen ist sauberer und übersichtlicher. Statt Button1 z.B. btnLoad.
Bei Button4Click überschreibst du den gesamten Text in der Combobox, was denke ich mal dein Problem war?
Code:
combobox1.Text:=
Wenn du mehrere ComboBox Einträge in einer ini sichern möchtest, würde ich die Anzahl der Einträge in die ini schreiben und mit einer Schleife für jeden einzelnen Eintrag in der ComboBox eine neue Zeile in der Ini anlegen.
Hab den Code mal zusätzlich durch ne Schönheits OP geschickt
Edit: Hier nochmal als Projekt Datei:
Code:
procedure WriteToIni(filename, section, key, value: string);
var
ini: TIniFile;
begin
ini := TIniFile.create(filename);
try
ini.WriteString(section, key, value);
finally
ini.free;
end;
end;
function ReadFromIni(filename, section, key: string): string;
var
ini: TIniFile;
begin
ini := TIniFile.create(filename);
try
result := ini.ReadString(section, key, '')
finally
ini.free;
end;
end;
procedure TForm1.btnSaveClick(Sender: TObject);
var
i: Integer;
filename: string;
begin
filename := ExtractFilePath(Application.Exename) + 'realmlist.ini';
WriteToIni(filename, 'myverse', 'NumEntrys', IntToStr(ComboBox1.Items.Count));
for i := 0 to ComboBox1.Items.Count - 1 do
begin
WriteToIni(filename, 'myverse', Format('name_%d', [i]), combobox1.Items[i]);
end;
end;
procedure TForm1.btnLoadClick(Sender: TObject);
var
filename: string;
i, NumEntrys: Integer;
begin
filename := ExtractFilePath(Application.Exename)+'realmlist.ini';
if FileExists(filename) then
begin
NumEntrys := StrToInt(ReadFromIni(filename, 'myverse', 'NumEntrys'));
for i := 0 to NumEntrys - 1 do
begin
ComboBox1.Items.Add(ReadFromIni(filename, 'myverse', Format('name_%d', [i])));
end;
end;
end;
DELPHI - Who make Exploits, Hacks and Tools with DELPHI? 05/15/2013 - CO2 Programming - 13 Replies Hi all.
Iwith DELPHI, but a dont now.
hello, I use Delphi to program and i like someone put here source code of make Exploits, Hacks and Tools bot here, or part of the code.
ty to all
[DELPHI&METIN]Wie sind die Delphi Befehle für einen Bot? 03/07/2010 - General Coding - 3 Replies Hallo liebe com,
ich habe mal eine Frage: Ich möchte einen Metin Bot in Delphi schreiben aber ich weiß nicht die Befehle für
eine bestimmte Taste senden etc.
könnt ihr mir die pls sagen oder per pn geben
MfGGGGGG
My PSF Launcher to USF Launcher??? [PATCH]??? 12/19/2009 - Soldier Front Philippines - 6 Replies †Does anyone have a Patch for making a PSF Launcher to USF Launcher?
†Is it posible?
†I just wanna ask.
*If you have, Please Release it here in "EPvP"
*and also Sir †DARNOC†, Please close this thread to avoid spamming. tnx!
WTS WR LVL 94 Delphi 08/16/2009 - Perfect World Trading - 0 Replies hi i sell my wr lvl 94 on delphi server
full hh 90 eq all eq + 4
pm me with offers
http://pic.ipicture.ru/uploads/090816/0R6aEiSjtU. jpg
http://pic.ipicture.ru/uploads/090816/MJnZPenKdT. jpg