一个DBgrid控件,不和database连接,
如何限定行数和列数,并使用picklist进行选择输入。

解决方案 »

  1.   

    用StringGrid处理不是更适合你的需要吗?
      

  2.   

    //在DBGrid的colEnter事件写下如下代码,即可实现下拉列表
    with DBGri1.selectedfield do
    if (FieldName='field1') then //field1下拉显示FieldMc值
         with adoquery1 do
         begin
           close;
           sql.Clear ;
           sql.Add('select distinct fieldmc from  table1 ');//信息来源表
           open;
           if recordcount>0 then
           begin
            first;
            with DBgrid1  do
            for j:=1 to FieldCount do
             if columns[j].FieldName ='fieldmc' then
             begin
              columns[j].PickList.Clear;
              for i:=1 to recordcount do
               begin
               columns[j].PickList.Add(fieldbyname('fieldmc').value);
               next;
               end;
               break;
             end;
           end;
           close;
         end;
      

  3.   


       同意  FrameSniper(§绕瀑游龙§)