Hi,
I have a class that's inherited from the DataTable class, and I discovered
an interesting behavior with data binding. Consider the code:
public class GenTable : System.Data.DataTable
{
public GenTable(){}
private string sTestValue ="Test";
public string TestValue
{
set {sTestValue = value;}
get {return sTestValue;}
}
}
private void button1_Click(object sender, System.EventArgs e)
{
GenTable gt = new GenTable();
textBox2.DataBindings.Add("Text", gt, "TestValue");
}
---
The line textBox2.DataBindings.Add("Text", gt, "TestValue"); generates an
error:
Cannot bind to property or column TestValue on DataSource.
If I don't derive from DataTable, then there is no error. Can anybody shed
some light into this mystery?
Thanks a lot!
--
Zhenya
http://www.rusmex.com