Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1310
combo.displaymember not showing the column I set.
posted

I am needing to change my combo.valuemember during run-time depending on certain user interaction.

The combo datasource is an ultradatasource with 5 columns.  Is it OK to be changing the combo.valuemember during run-time?   I am switching between two columns (One column is decimal and the other is string).  Would this effect the combo.displaymember? 

The reason I am asking is because when I switch the valuemember, the combobox is not displaying the column I have set in the combo.displaymember.   It is displaying another column.

any ideas?

  • 469350
    Verified Answer
    Offline posted

    Hi,

    You probably have to change the Value, as well.

    If the ValueMember is a string column, then then Value of the combo is going to be a string. When you change the ValueMember to a decimal column, the current Value of the combo (a string) will not match up to any of the items on the list.

    So you probably need to store the value of the decimal column in the current SelectedRow, then change the ValueMember, then set the Value.