468,296 Members | 1,306 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,296 developers. It's quick & easy.

Strange behavior data-bound combobox

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
2 1785

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
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.

Similar topics

reply views Thread by John Hunter | last post: by
1 post views Thread by Mei | last post: by
11 posts views Thread by Marlene Stebbins | last post: by
reply views Thread by ivb | last post: by
2 posts views Thread by Antonio | last post: by
10 posts views Thread by John Kraft | last post: by
2 posts views Thread by Victor Lin | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.