ComboBox binding to DataTable. SelectedValue problem...

A

Aleksey Timonin

Hi guys,
I have a comboBox binded to DataTable:
comboBox.DataSource = MyDataTable;

comboBox.ValueMember = "id";

comboBox.DisplayMember = "id";



Than in my code I need id = 3 to be selected in the comboBox. So I have a
code:

comboBox.SelectedValue = 3;

I don't have any event or any code after that may change the SelectedValue,
but in result I get wrong id shown in the comboBox!!!

Does anybody meet such a problem? How can I resolve it? What's wrong here?

Thanks a lot

Aleksey
 
A

Aleksey Timonin

I think I know the problem reason. comboBox.Sort property for my ComboBox
was true. After I changed it to false everything works perfect. MS bug?
Comments...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top