procedure TfrmMain.ReadBox;
var
Str: string;
begin
cmbxSlsNumber.Clear;
Str := ReadIni(IniFileName,'Main','Number');
if Str = '' then Exit;
while Pos(',',Str) > 0 do
begin
cmbxSlsNumber.Items.Add(Copy(Str,1,Pos(',',Str)-1));
Delete(Str,1,Pos(',',Str));
end;
cmbxSlsNumber.ItemIndex := 0;
end;
procedure TfrmMain.WriteBox;
var
Str: string;
i, j: integer;
begin
if cmbxSlsNumber.Items.Count = 0 then
begin
Str := cmbxSlsNumber.Text + ',';
WriteIni(IniFileName,'Main','Number',Str);
end;
for i := 0 to cmbxSlsNumber.Items.Count -1 do
begin
if cmbxSlsNumber.Text = cmbxSlsNumber.Items then
Exit;
end;
Str := cmbxSlsNumber.Text + ',';
for j := 0 to cmbxSlsNumber.Items.Count -1 do
begin
Str := Str + cmbxSlsNumber.Items[j] + ',' ;
WriteIni(IniFileName,'Main','Number',Str);
end;
end;
WriteIni和ReadIni是一个读写INI文件的函数