以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [分享]发现combobox 中奇怪的现象  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=62632)

--  作者:loongtai
--  发布时间:2015/1/5 16:29:00
--  [分享]发现combobox 中奇怪的现象
combobox控件中的Enter事件中代码如下:
e.sender.DataSource="数据字典"
e.sender.DisplayMember="显示值"
e.sender.ValueMember="代码"
e.sender.DataFilter="列名=\'仓库\'"
这样运行时会发现,下拉列表中无任何值,
但是将代码顺序换下:
e.sender.DisplayMember="显示值"
e.sender.ValueMember="代码"
e.sender.DataSource="数据字典"
e.sender.DataFilter="列名=\'仓库\'"
则可以成功显示。

--  作者:Bin
--  发布时间:2015/1/5 16:33:00
--  
设置了DataSource 之后才会开始生成.
--  作者:loongtai
--  发布时间:2015/1/6 9:16:00
--  
我的理解是,先只有设定了datasource以后才能设定其它项,所以datasource的设置应该放在最前面。
--  作者:Bin
--  发布时间:2015/1/6 9:23:00
--  
先设置 再指定datasource
--  作者:有点甜
--  发布时间:2015/1/6 9:24:00
--  
 帮助中有说明的,要调整好次序。