I've created objects before that I could bind to UI controls, but now
I want to do sort of the opposite. I want to bind an object to a
table such that the current rows columns map to properties of the same
name in the object.
I have been halfway successful by inheriting from the
BindableComponent class and then using code such as
court.DataBindings.Add("ColumnName1", codesCourtBindingSource,
"ColumnName1");
....where court is my object, codesCourtBindingSource has a DataSet as
its DataSource and the table name as it's DataMember.
However, this means I have to write a line of code for every column.
I have done bindings before where I could specify an empty string for
the property name and datamember, and it binds all the names which
match. In this scenario though, I haven't had any success with this:
court.DataBindings.Add("", codesCourtBindingSource, "");
I wanted to implement IBindableComponent so that I could intercept
calls and see what was going on under the hood with this binding
stuff, but I have no idea how to create this implementation and
haven't found any fleshed out examples.
If anyone has links to examples of implementing IBindableComponent,
I'd be interested.