数据绑定-使用TextBox DataBind c#更改/更新对象值
本文关键字:更新 对象 更改 使用 TextBox DataBind 数据绑定 | 更新日期: 2023-09-27 17:58:14
在我的代码中,我有这样的东西:
myTextBox.DataBindings.Add(new Binding("Text", myObject, "id",
true,System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged, "0", "N0"));
绑定工作正常,但当我更改文本框的值时,我的id值不会刷新。
这对我有效,
myTextBox.DataBindings.Add(new Binding("Text", myPlane, "id")
在我的类中添加接口INotifyPropertyChanged:
class Planes : INotifyPropertyChanged
{}