Delphi之ComboBox
2017-01-11 15:05 绿贝 阅读(2141) 评论(0) 编辑 收藏 举报
手动添加数据到ComboBox
jcsqueryResult.First; while not jcsdqryvehiclebydriverid.Eof do //从TJsonClientDataSet中取出数据,存到ComboBox中 begin v := Vehicle.Create();//这个类有vehicleno和id2个属性。 v.vehicleno :=jcsqueryResult.FieldByName('vehicleno').AsString; v.id := jcsqueryResult.FieldByName('vehicleid').aslargeint;
NovaVehicleNoComboBox.Items.AddObject(v.vehicleno, TObject(v)); //存到ComboBox中
jcsqueryResult.Next;
end;
从ComboBox中取出选择的数据。
ve := (NovaVehicleNoComboBox.Items.Objects[NovaVehicleNoComboBox.ItemIndex] as Vehicle);