Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

VB
categorycombo.DataSource=CategorySect.Tables(0).Select("Type = 'ICD'")
categorycombo.DisplayMember = "Name"
categorycombo.ValueMember = "Name"


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
Posted
Updated 17-Nov-12 9:06am
v2

1 solution

I fixed it myself. Posting here for reference to others.

VB
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900