Q: Bind SQL table to TreeView

  • Thread starter Thread starter Martin Arvidsson
  • Start date Start date
M

Martin Arvidsson

Hi!

I have a table containing three columns, containing following data..

ID, SUB, DESCRIPTION
1,0,Main
2,0,Main2
3,2,Main2 Subto2

What i want to do is to fill the tree view with the data

if sub is non zero, i want to create a subtree of ID...
Is it possible or do i have to fill a DataSet, read all data and manually
set the data to the treeview?

Regards
Martin
 
You will have to create a typed DataSet and add a relation between the
ID field and SUB field. If you are using the standard TreeView you
will then have to use the relation to navigate the data and add nodes
to the TreeView programatically.

If you are willing to consider a commercial solution Infralution's
Virtual Tree can make this last part much easier. It provides a
flexible data binding mechanism that allows you to bind directly to the
data in the dataset - so you don't have to do this manually.

You can find more information and a fully functional evaluation version
at:
www.infralution.com/virtualtree.html

Regards
Grant Frisken
Infralution
 
Back
Top