当一个项目被选中组合框显示重复项目 [英] Combobox displays duplicate items when an item is selected

查看:256
本文介绍了当一个项目被选中组合框显示重复项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体上的数据绑定组合框。当我选择一个项目,所有其他绑定组件的正确更新。然而,下拉项的列表改变,使得所选择的项目是重复在列表中。例如,原来这里是清单:

I have a data-bound combobox on a Windows form. When I select an item, all of the other bound components update properly. However, the list of drop-down items changes so that the selected item is duplicated in the list. For example, here is the original list:

这是列表中的样子,当我选择一个项目:

This is what the list looks like when I select an item:

组合框绑定到BindingSource的是获取其数据从LINQ to SQL查询。显示件是SpecName,数值成员是规范ID,选择的值是在的BindingSource的规范ID字段。

The combobox is bound to a bindingsource that gets its data from a LINQ to SQL query. The Display Member is the SpecName, the Value Member is the SpecID and the Selected Value is the SpecID field in the bindingsource.

我怎样才能纠正这种重复的行为呢?

How can I correct this duplication behavior?

推荐答案

当我遇到类似的情况,原因是该组合框数据绑定|。Text属性

When I encountered a similar situation, the cause was the combobox Databindings|Text property.

我可以重复的,当这个属性被设置为相关的绑定源和显示领域的行为描述。

I could duplicate the behavior described when this property was set to the relevant binding source and display field.

将该属性设置为无造成的行为停止。

Setting the property to None caused the behavior to cease.

这篇关于当一个项目被选中组合框显示重复项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆