Uncertain response from Combobox SelectedItem

Posted by MSingh on Stack Overflow See other posts from Stack Overflow or by MSingh
Published on 2012-12-01T10:28:34Z Indexed on 2012/12/01 11:04 UTC
Read the original article Hit count: 245

Filed under:
|

I am working in winform and using combobox.

I set the properties of combobox in this sequence

combobox.DisplayMember = "cust_name";
combobox.ValueMember="cust_id";
combobox.datasource=dtCustomer;

I have used combobox in my application several times, I don't know where I am making mistake as

Sometime SelectedItem property returns exact value (int,string) based on the data type of "ValueMember" property, but sometime it returns "DataRowView".

I've read this is because of the sequence in which properties are setting in combobox. But this is not the case now.

Binding code is

enter image description here

Calling code is

enter image description here

© Stack Overflow or respective owner

Related posts about winforms

Related posts about combobox