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;

posted @ 2020-04-24 09:02  绿水青山777  阅读(243)  评论(0编辑  收藏  举报