【发布时间】:2012-07-03 06:21:59
【问题描述】:
我被难住了。我的 c# AddressForm 上有以下行
lkuCounty.DataBindings.Add("EditValue", Address, "County.CountyID", true);
这在 64 位 Win7 机器上效果很好,但在 Win XP 32 位机器上我得到以下异常:
Type: System.ArgumentException
Message: Cannot bind to the property or column CountyID on the DataSource.
Parameter name: dataMember
我猜我遗漏了一些细微差别,非常感谢一些帮助。
这是我在一个单独项目中的类(没有构造函数)(myproject.Common)
public class County
{
public short? CountyID { get; set; }
public string CountyName { get; set; }
}
public class Address
{
public int AddressID { get; set; }
public string AddressLine1 { get; set; }
public string AddressLine2 { get; set; }
public string AddressLine3 { get; set; }
public string City { get; set; }
public string Zip { get; set; }
public County County { get; set; }
}
【问题讨论】:
-
你尝试过干净的构建吗?
-
是的,还是不行。我很困惑。在这一点上,我想我只需要用 CountyID 属性替换它并转储 County Class。我不知道为什么这不起作用,这让我很困扰。
-
你要绑定什么控件?
-
标准文本框或 DevExpress 文本框编辑。都试过了。
-
这里,同样的问题,你解决了吗?
标签: c# .net winforms data-binding