AddObject使用 D10
不用 newstr
procedure TForm1.cbb1CloseUp(Sender: TObject);
begin
edt1.Text := PString(cbb1.Items.Objects[cbb1.ItemIndex])^ + ':' + qry1KESMC.AsString;
end;
procedure TForm1.FormShow(Sender: TObject);
var ss:PString;
begin
cbb1.Items.Clear;
qry1.First;
while not qry1.Eof do
begin
New(ss); //创建
ss^ := qry1KESBM.AsString;
cbb1.Items.AddObject(qry1KESMC.AsString,TObject(ss));
qry1.Next;
end;
end;
for I := 0 to cbb1.Items.Count - 1 do
begin
Dispose(Pstring(cbb1.Items.Objects[i])); //释放
end;