如何在DBGRID构件中的指定列显示COMBOBOX构件并使COMBOBOX显示记录中的内容?请给个例子?我有一个例子是delphi4环境下的,编译不能通过,我用的是delphi6

解决方案 »

  1.   

    DBGridEH我安装了,但不会用!unit UnitForm1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Grids, DBGridEh;  <----------在这里出错!
      

  2.   

    在porject/options/里边把dbgrideh所在的文件夹加入到serarch path
      

  3.   

    搂主,换个角度去做,试一下
    With adoquery1 do//下拉框里添加产品型号
       begin
          Active:=False;
          sql.clear;
          sql.add('Select DBGRID里的列名 from 与DBGRID相关的表');
          Open;
          While not Eof do
          begin
            Combobox1.Items.Add(fieldvalues['列名'].asstring);
            
            next;
          end;
       end;
      

  4.   

    look!http://218.56.11.178:8020/web/technology.aspx->下载基地->例程-数据库/报表->在DBGRID中下拉列表的显示
      

  5.   

    DBGRID中下拉列表的显示————写在什么地方好呀!
      

  6.   

    在form上放一个ComboBox组件,设定它的visible为false
    先把另一个数据表的可用记录放入其中procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    begin
      if gdfocused in state then
      begin
        if column.FieldName='xxx' then    //xxx为你要让combobox显示的那列的字段名
        begin
          ComboBox1.Left:=rect.Left+form1.DBGrid1.Left;
          ComboBox1.Top:=rect.Top+form1.DBGrid1.Top;
          ComboBox1.Width:=rect.Right-rect.Left;
          ComboBox1.Height:=rect.Bottom-rect.Top;
          ComboBox1.Visible:=true;
        end;
      end;
    end;