|
-
Feb 27th, 2004, 03:14 AM
#1
Thread Starter
Hyperactive Member
Fill Treeview
Hi group,
I need to fill a treeview in a C# winform app with nodes (root, childs, sibblings…)
I’ve got a table with these fields:
ChildID (number) Primary Key
Item (text)
ParentID (number)
Here’s some example data:
ChildID Item ParentID
1 Item 1 0
2 Item 1.1 1
3 Item 1.1.1 2
4 Item 1.2 1
5 Item 2 0
6 Item 2.1 5
I need to create a tree like this:
ROOT
- Item 1
o Item 1.1
§ Item 1.1.1
o Item 1.2
- Item 2
o Item 2.1
I know how I can add nodes childs and sibbling to a treeview but how do I create something (array, DataReader, whatever) to build the above?!
TIA
SD
-
Feb 29th, 2004, 02:24 PM
#2
Frenzied Member
need to know where the data comes from. Is it in a db, flat file, xml, or in code?
Magiaus
If I helped give me some points.
-
Mar 1st, 2004, 01:20 AM
#3
Thread Starter
Hyperactive Member
Hi Magiaus,
the data is coming from an Access 2000 DB (making plans to migrate to SQL - S.)
Sander
-
Mar 1st, 2004, 12:03 PM
#4
Frenzied Member
I don't have that code handy and I'm to tired right now to write imaginary code...
You need a connection a command and an adapter. oledb.. setup the connection and command to get data with say a select statement and set the adapter to use them then you use the adapter to fill a datatable in a dataset or just use the datatable.
I don't know about binding a treeview.
If you still need help I'll be more useful after I get some sleep.... I think I'll be dreaming about regions and pixels.....
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|