Hi, I have a class like this:
public class Person
{
Int32 id;
Boolean isMarried = false;
String displayName;
Detail mainDetail = new Detail();
Detail partnerDetail = new Detail();
}
public class Detail
{
String firstName;
String lastName;
DateTime dob;
String address;
}
And then a Form which has selected textboxes to show the information in the object. This is to be updated when the selected person is changed.
Now, for simple fields, such as displayName, this is a piece of cake:
txtTitle.DataBindings.Add("Text", selectedPerson, "displayName");
but how do I bind another TextBox to the firstName of the mainDetail property?
This attempt:
txtFirstNameMain.DataBindings.Add("Text", selectedPerson.mainDetail, "firstName");
returns a runtime error:
"Cannot bind to the property or column firstName on the DataSource. Parameter name: dataMember"
Thanks for your help!