Click here to Skip to main content
12,452,344 members (51,496 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET3.5 VB .NET 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 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 17-Nov-12 8:53am
Updated 17-Nov-12 9:06am
Nelek97.9K
v2

1 solution

Rate this: bad
 
good
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.
  Permalink  

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 | Mobile
Web02 | 2.8.160826.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2016
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