By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,668 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,668 IT Pros & Developers. It's quick & easy.

ComboBox binding to DataTable. SelectedValue problem...

P: n/a
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
Jun 29 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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...

"Aleksey Timonin" <al******@mdgmedical.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
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


Jun 29 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.