Reputation: 4807
I am using VB.Net 2010, and when I run the following code, I get System.Data.DataViewManagerListItemTypeDescriptor displaying in the dropdownlist box
cmbProdType.DataSource = ds
cmbProdType.DisplayMember = "ProductType"
cmbProdType.ValueMember = "ProductCode"
When I hover over the datasource, I can see the correct records. But its not displaying in the dropdownlist control.
Upvotes: 2
Views: 579
Reputation: 1294
First of all I don't usually bind to a dataset, I bind to the datatable in the dataset, but it looks like you have that working?
Second I set the datasource after I tell it the display and value members.
EDIT:
Dim ds As New DataSet
Dim dt As New DataTable("dt")
dt.Columns.Add("ProductType")
dt.Columns.Add("ProductCode")
For i = 0 To 10
Dim dr As DataRow = dt.NewRow
dr.Item("ProductType") = ChrW(i + AscW("A"))
dr.Item("ProductCode") = i
dt.Rows.Add(dr)
Next
cbo.DisplayMember = "ProductType"
cbo.ValueMember = "ProductCode"
cbo.DataSource = dt
Upvotes: 2