现在的位置: 首页 > 综合 > 正文

CxGrid列ComboBox动态加入数据内容的解决方法

2013年02月15日 ⁄ 综合 ⁄ 共 610字 ⁄ 字号 评论关闭

Cxgrid的一列,property为comboBox,实现动态添加item方法

 

(列名.Properties   as   TcxComboBoxProperties).items.add("你要增加的项目");

 

 

procedure TnPOP_DCzuzhuang.FormActivate(Sender: TObject);
begin

(cxGrid1DBTableViewtype.Properties as TcxComboBoxProperties).Items.Clear;
     qry_type.Close;
     qry_type.SQL.Text:='select distinct itemname from t_mi_item';
     qry_type.Open;
     while not qry_type.Eof do
      begin
        if length(trim(qry_type.fieldbyname('itemname').AsString))<>0 then
          (cxGrid1DBTableViewtype.Properties as TcxComboBoxProperties).Items.Add(qry_type.fieldbyname('itemname').AsString);
        qry_type.Next;
      end;

  end;

抱歉!评论已关闭.