Has anyone been able to bind a collection (array, custom collection, etc.) to a control? I have a custom collection that extends ArrayList and need to bind it to a DataGrid. All to SDK docs examples are for DataSets.
This is my GSWidget class. It contains a custom collection of child GSWidgets. The GSCollection class extends ArrayList.
private class GSWidget
{
public int Value = 0;
public GSCollection Children = new GSCollection();
public GSWidget()
{
Random rnd = new Random();
Value = rnd.Next(1, 1000);
}
}
These are things I've tried:
dataGrid1.DataSource = myWidgets;
dataGrid1.DataMember = "Children.Value";
comboBox1.DataSource = myWidgets;
comboBox1.DisplayMember = "Children.Value";
comboBox1.DataBindings.Add("Text", myWidgets, "Children.Value"
Both of these result in the same ArgumentException: "Can't create child list for field Children".
Any ideas?
This is my GSWidget class. It contains a custom collection of child GSWidgets. The GSCollection class extends ArrayList.
private class GSWidget
{
public int Value = 0;
public GSCollection Children = new GSCollection();
public GSWidget()
{
Random rnd = new Random();
Value = rnd.Next(1, 1000);
}
}
These are things I've tried:
dataGrid1.DataSource = myWidgets;
dataGrid1.DataMember = "Children.Value";
comboBox1.DataSource = myWidgets;
comboBox1.DisplayMember = "Children.Value";
comboBox1.DataBindings.Add("Text", myWidgets, "Children.Value"
Both of these result in the same ArgumentException: "Can't create child list for field Children".
Any ideas?