显示成员,带有“表选择"选项 [英] Display member with Table Select Option
问题描述
大家好,
我有一个带有多个表的数据集CategoySect.我正在选择一个数据如下的表.
Hello All,
I have a DataSet CategoySect with Multiple Tables. I am selecting one table with data as below.
Name Type
Test ICD
Test2 ICD
Test3 ICD2
Test4 ICD2
我使用的代码段是
Code Snippet I Use is
categorycombo.DataSource=CategorySect.Tables(0).Select("Type = 'ICD'")
categorycombo.DisplayMember = "Name"
categorycombo.ValueMember = "Name"
当我使用选择"选项将其用作组合框的数据源时,得到的消息为
Cannot bind to the new display member. Parameter name: newDisplayMember
如果我不使用Table.select就可以正常工作.但我想根据特定类型将数据加载到组合框中.有人可以指导我如何进行这项工作吗?
预先感谢任何/所有帮助.
AVK
When i use this as datasource for combobox with Select option i get a message as
Cannot bind to the new display member. Parameter name: newDisplayMember
If I use without Table.select it works fine. but i want to load data into combo box based on specific type. Can some one guide me as to how to make this work?
Thanks in advance for Any/All Help.
AVK
推荐答案
我自己修复了它.在此处发布以供他人参考.
I fixed it myself. Posting here for reference to others.
Dim DV As DataView = New DataView(CategorySect.Tables(0), "Type = 'ICD'", "Name", DataViewRowState.CurrentRows)
categorycombo.DataSource = DV
categorycombo.DisplayMember = "Name"
categorycombo.ValueMember = "Name"
由于我只是一个初学者,所以我不确定这是否是优化的方法,但这解决了我的目的.
Since I am just a beginner, I am not sure if this is the optimized way to do it or not, but this solved my purpose.
这篇关于显示成员,带有“表选择"选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!