Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: .NET3.5 VB.NET
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 9:53am
Edited 17-Nov-12 10: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)

Advertise | Privacy | Mobile
Web02 | 2.8.150301.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2015
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