combobox addobject 字符串

procedure TForm1.Button2Click(Sender: TObject);
begin
cbb2.Items.Clear;
OraQuery1.First;
while not OraQuery1.Eof do
begin
cbb2.Items.AddObject(OraQuery1.Fields[1].AsString,TObject(NewStr(OraQuery1.Fields[0].AsString)));
OraQuery1.Next;
end;
end;

procedure TForm1.cbb2Change(Sender: TObject);
begin
edt1.Text := PString(cbb2.Items.Objects[cbb2.ItemIndex])^;
edt2.Text := cbb2.Items[cbb2.ItemIndex];
end;

posted @ 2018-03-23 15:23  绿水青山777  阅读(300)  评论(0编辑  收藏  举报