I’v got a combobox that I created as a user control(it’s actually made up of a label, combobox and textbox). I’m trying to bind a dataset to the combobox datasource, but I keep getting an error message on ValueMember/Display member:
Cannot bind to the new display member - newdisplay member
Cannot bind to the new value member - parameter name: value
I thought I had everything coded correctly for the usercontrol:
public partial class ucComboBox : UserControl
{
#region Properties (6)
private bool isEditableReadOnly;
private bool ArrVisible;
private string _value;
private string _name;
public string value
{
get { return _value ; }
set { _value = value; }
}
public string name
{
get { return _name; }
set { _name = value; }
}
}
I have a few other properties and events in the usercontrol but they shouldnt be the issue.
My code to bind the info:
((ucComboBox)ctrl).combobox.DataSource = info;
((ucComboBox)ctrl).combobox.ValueMember = "radiology_id";
((ucComboBox)ctrl).combobox.DisplayMember = "radiology_name";
It blows up whenever it hits value member, and i get the two errors stated above. Am I missing something in my user control? Seems to me this should be working.. (fyi – the info datasource does contain the two columns)
I’ve tried a bunch of different tactics with no success. Please help!
Thanks
Moved away from using a Datatset. Created a class(“Facilities”) that will hold an ID and Name values. Changed “info” to a List type. Then the following code worked just fine:
No issues with binding that.