I'm trying to learn how to use WinForms databinding, but one thing that's confusing me is why you would "Add" a databinding rather then "Set" a databinding? For example consider the following code.
TextBox1.DataBindings.Add("Text", ds,"Customers.CustomerID")
As I understand it this line adds a databinding to TextBox1
that binds its Text
property to the CustomerID
fields in the Customers
table of the ds
DataSet
.
Yet to me the term "Add" implies that you can add multiple of something. Which confuses me in this example. Why would you have a textbox bound to multiple things? How could that even be possible? Can someone provide an example where multiple bindings make sense?
您还可以绑定其他字段,例如“已启用”。
TextBox1.DataBindings.Add("Enabled", myPresentationModel, "IsTextBox1Enabled");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.