我想要Databind到我的自定義字典類。在formLoad中,我可以綁定到Car.Desc,但我無法綁定到RatesCache.Desc。 它們都是公共字符串屬性。c#DataBinding通用的字符串屬性
我錯過了什麼?
謝謝!
System.ArgumentException了未處理 消息=「無法結合於數據源的屬性或列說明\ r \ n參數名稱:數據成員」 源=「System.Windows.Forms的」 PARAMNAME =「數據成員」
public class RatesCache : Dictionary<int, Rate>
{
public string Desc { get; set; }
}
public class Car
{
public string Desc { get; set; }
}
static Car car = new Car();
static RatesCache rc = new RatesCache();
private void Form1_Load(object sender, EventArgs e)
{
rc.Desc = "hello too";
car.Desc = "Im a car";
textBox1.DataBindings.Add("Text", rc, "Desc");
}