I'm not sure I understand the question entirely. You mean you're binding a
DataTable to the control? Is it cast as a DataTable?
A better (and more generic and .NET) method would be to provide a DataSource
(object) and DataMember (string) similar to the way the grid does.
Then you would get a CurrencyManager from the BindingContext like so:
CurrencyManager cm = BindingContext[dataSource, dataMember] as
CurrencyManager;
Subscribe to the CurrencyManager events (ItemChanged, CurrentChanged,
MetaDataChanged, PositionChanged) to get updates about changes to the
underlying data and use the CurrencyManager to actually retrieve the data.
This gives you the advantage of being able to bind any IList or IListSource
implementor to your control. This includes DataSets, DataTables, DataViews,
DataViewManagers, arrays, and so forth. Since the CurrencyManager handles
all the data transport, you don't actually have to care what kind of data
you're bound to.
There are two articles on my web site about the CurrencyManager that you
might find helpful:
http://www.petedavis.net/MySite/DynP...aspx?pageid=19
and
http://www.petedavis.net/MySite/DynP...aspx?pageid=22
In addition, this page has some good information:
http://noiseehc.freeweb.hu/CurrencyManager.html
Pete
"Alvaro E. Gonzalez V." <ag********@gmail.com> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...
Hi;
I'm building a control that has a DataTable's property type. The control
contains treeview which is populated in foreach crossing rows of the
DataTable established in the property.
I require a mechanism so that when they change the loaded data of the
DataTable these are reflected in treeview.
Somebody can offer information to me...
Thanks...
Alvaro.