uses
inifiles;
[User]
Nikename0=高级管理员
Nikename1=pop
Nikename2=11
Nikename3=11
Nikename4=22
Nikename5=55
Nikename6=333
Nikename7=555
Nikename8=ggg
Nikename9=王77
-----
你的INI文件格式不大对吧。
procedure TFrmLogin.LoadNikename;
var
FFile:TIniFile;
i:integer;
FStr:String;
begin
cb_Nikename.Items.Clear;
cb_Nikename.Items.Add('');
FFile:=TIniFile.Create(GetAppPath+IFileName);
for i:=0 to 9 do
begin
FStr:=FFile.ReadString('User','Nikename'+IntToStr(i),'');
if FStr<>'' then
cb_Nikename.Items.Add(FStr);
end;
FFile.Free;
end;
procedure TFrmLogin.SaveNikename;
var
FFile:TIniFile;
i:integer;
index:integer;
begin
FFile:=TIniFile.Create(GetAppPath+IFileName);
if cb_Nikename.Items.IndexOf(cb_Nikename.Text)<0 then
cb_Nikename.Items.Add(cb_Nikename.Text);
for i:=0 to 9 do
begin
index:=cb_Nikename.Items.Count-1-i;
FFile.WriteString('User','Nikename'+inttostr(i),cb_Nikename.Items[index]);
end;
FFile.Free;
end;。。