August 2003
Intermediate to advanced
736 pages
14h 48m
English
Although the data set is a popular data source, it's by no means the only one. Any custom type can be a data source.
The requirements of an item data source are only that it expose one or more public properties:
// Expose two properties for binding
class NameAndNumber {
public string Name {
get { return name; }
set { name = value; }
}
public int Number {
get { return number; }
set { number = value; }
}
string name = "Chris";
int number = 452;
}
NameAndNumber source = new NameAndNumber();
void CustomItemDataSourceForm_Load(object sender, EventArgs e) {
// Bind to public properties
textBox1.DataBindings.Add("Text", source, "Name");
textBox2.DataBindings.Add("Text", source, "Number");
}
In this case, ...
Read now
Unlock full access