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

Strange behavior data-bound combobox

P: n/a
I am using a data-bound combobox with dropdownstyle set to
dropdownlist. Teh combobox is bound to a bindingsource which is in turn
bound to a table in my database. The table has only 4 rows and I am
using it to display geographical regions - Northeast, Southeast, West,
and Central. In the bindingsource AddNew is set to false.

Whenever I select an item from the combobox I find that the position in
the dropdown list is replaced by the value that was displayed prior to
making the new selection. For example when I start the application and
view the dropdown list I see the following

West
Central
Southeast
Northwest

with West being initially displayed in the textbox. If I select
Southeast the list changes to the following

Southeast
Central
Southeast
Northwest

and Southeast is displayed in the textbox. I can no longer select West
because it is no longer in the dropdown list !!!!

This seems like a bug to me -- or is that how the combobox is supposed
to work? I want my list to be immutable.

What am I doing wrong?

Thanks,

Crazy

Feb 8 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Crazy Cat wrote:
I am using a data-bound combobox with dropdownstyle set to
dropdownlist. Teh combobox is bound to a bindingsource which is in turn
bound to a table in my database. The table has only 4 rows and I am
using it to display geographical regions - Northeast, Southeast, West,
and Central. In the bindingsource AddNew is set to false.

Whenever I select an item from the combobox I find that the position in
the dropdown list is replaced by the value that was displayed prior to
making the new selection. For example when I start the application and
view the dropdown list I see the following

West
Central
Southeast
Northwest

with West being initially displayed in the textbox. If I select
Southeast the list changes to the following

Southeast
Central
Southeast
Northwest

and Southeast is displayed in the textbox. I can no longer select West
because it is no longer in the dropdown list !!!!

This seems like a bug to me -- or is that how the combobox is supposed
to work? I want my list to be immutable.

What am I doing wrong?

Thanks,
Sorry to respond to myself but I found the solution and wanted to share
it should anyone run into this problem. The problem was that I had set
Data Source and Data Member properties of the data-bound control,
without realizing that the Data Set Manager had set the Text property
under the Databindings properties (it's easy to miss since the Text
property is a sub property of the Databindings and is not visible until
you expand Databindings). Anyways once I set the Text subproperty to
nothing all was fine.
Crazy


Feb 8 '06 #2

P: n/a
CMM
Seems like you have bound the "DataSource" property (which only provides the
list of items) and the Text property (which gets and updates a field in a
dataset) to the same thing. Just a quick guess. They're supposed to be
different.
Feb 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.