Hi,
I am providing itemssource of a combobox to be a NameValueCollection.
But I am not able to see any thing in combo when I set the property:
cmb.DisplayMemberPath="Value";
I want the values of NameValueCollection to be displayed in combo.
How can i do this.!!!
Please help.
Thanks,
Priyanka
Loading
PriyankaPosted Mar 13, 2010, 9:08 AM
This all works well with other collections,
but I am not able to get the values get displayes in combobox if binded to a NAMEVALUECOLLECTION specifically, if I provide a DisplayMemeberPath.
Amit ChoudharyPosted Mar 11, 2010, 4:23 AM
Here is the code for simple binding a ComboBox with a DataView or Datasource:
// Combobox Databinding
cbCust.DataSource = dsView;
cbCust.DisplayMember = "Customers.CompanyName";
cbCust.ValueMember = "Customers.CustomerID";
If you want to bind your ComboBox with a CustomDataClass then here is the code lines:
ComboBox1.Databindings.Clear
ComboBox1.Databindings.Add ("SelectedItem", objDataClass,
"myDataClassProperty")Hope it helps you.
Please mark as answer if your problem get solved.