Winforms 使用bindingsource填充组合框
在windows窗体上,所有文本框和组合框都是从acctPackageBindingSource绑定的。我的问题是组合框中的biniding只显示int值,这意味着它来自acctPackage。我想显示这个名称,它表示该值的“Displaymember”。来自不同表名的是sysCode。因此,如何才能完美地显示显示成员。下面是我的代码Winforms 使用bindingsource填充组合框,winforms,c#-4.0,bindingsource,Winforms,C# 4.0,Bindingsource,在windows窗体上,所有文本框和组合框都是从acctPackageBindingSource绑定的。我的问题是组合框中的biniding只显示int值,这意味着它来自acctPackage。我想显示这个名称,它表示该值的“Displaymember”。来自不同表名的是sysCode。因此,如何才能完美地显示显示成员。下面是我的代码 // Here the all value is coming form Syscode table . public void FillDropDown
// Here the all value is coming form Syscode table .
public void FillDropDown()
{
if (_commonComponent == null)
_commonComponent = new CommonComponent();
List<SysCode> _syscode = _commonComponent.GetByTableCodeForIncomeDedMapping("19");
bindingSourceSysCode.DataSource = _syscode;
packageCodeComboBox.DataSource = bindingSourceSysCode;
packageCodeComboBox.DisplayMember = "Desclong2";
packageCodeComboBox.ValueMember = "PackageCode";
}
//This part is bind my all value on the form
private void FillAcctPackage()
{
if (_commonComponent == null)
_commonComponent = new CommonComponent();
acctPackageBindingSource.DataSource = _commonComponent.GetAcctPackge();
}