W wangyb32 Unregistered / Unconfirmed GUEST, unregistred user! 2009-05-20 #1 窗体中有一个listbox,其中的内容是数据表中的字段名,我想在点击查询按钮的时候,在DBGrid中只显示listbox中的字段的字段值。请问各位高手该怎么实现?有参考的代码吗?
S super-ljc Unregistered / Unconfirmed GUEST, unregistred user! 2009-05-20 #2 i:=listbox.itemindex;if 1<>-1 then begins:=listbox.items;for I=0 to dbgrid.datasource.dataset.fieldscouny-1 doif dbgrid.column.fieldname=s then dbgrid.column.visual:=true else dbgrid.column.visual:=false;end;
i:=listbox.itemindex;if 1<>-1 then begins:=listbox.items;for I=0 to dbgrid.datasource.dataset.fieldscouny-1 doif dbgrid.column.fieldname=s then dbgrid.column.visual:=true else dbgrid.column.visual:=false;end;