NameValueList and ComboBox.

NameValueList and ComboBox.

Old forum URL: forums.lhotka.net/forums/t/543.aspx


shahram posted on Wednesday, July 05, 2006

Hi!

I have a NameValueList ConatactTypes and I use it to populate a combobox like this:

combobox .ValueMember = "key";

combobox .DisplayMember = "value";

combobox .DataSource = ConatactTypes ;

listBox1.Show();

so far so good!

then in Edit Customer form I have the customer rootobject as datasource for form that has a ContactTypeID and

I do like this:

this.combobox .DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this._CustomerBindingSource, "ContactTypeID", true));

now I expect that combobox shows the item with selectedvalue set to Customer.ContacttypeID but it is nat the case selectedvale is null.

I have done 10000 way and it just doesn't work .

So somebody knows what I must do?

Regards

dcb replied on Thursday, July 06, 2006

I have gotten around this be setting the blank values id to zero.

David

 

Copyright (c) Marimer LLC