Click here to Skip to main content
13,145,603 members (43,760 online)
Rate this:
Please Sign up or sign in to vote.
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"

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 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.

Posted 17-Nov-12 8:53am
Updated 17-Nov-12 9:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100