Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / October 2007

Tip: Looking for answers? Try searching our database.

How to populate a treeview from a dataset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xmail123@yahoo.com - 16 Oct 2007 23:51 GMT
I am very new to C#.  I need to create a Windows form that will read a
SQL table and populate a treeview.  I can connect to the DB, create
the dataadapter, populate a data set.  The problem is how to use the
dataset to populate a treeview.

I have looked at a few examples but none use a dataset, or the
data structure was different and I could not modify to work with my
data or the examples were more than I needed and too complex for a
beginner.  Can some one suggest a URL, book or show me an example of
code that simply takes the data as shown and populates a treeview.

I would really appreciate the help.

Thank you.

I have a SQL Server 2005 table containing this data shown below.  

Child   Parent  depth   Hierachy
1    NULL    0    01
2    1    1    01.02
5    2    2    01.02.05
6    2    2    01.02.06
3    1    1    01.03
7    3    2    01.03.07
11    7    3    01.03.07.11
14    11    4    01.03.07.11.14
12    7    3    01.03.07.12
13    7    3    01.03.07.13
8    3    2    01.03.08
9    3    2    01.03.09
4    1    1    01.04
10    4    2    01.04.10
15    NULL    0    15
15    15    1    15.15
16    15    1    15.16
18    16    2    15.16.18
17    15    1    15.17
Eric Moreau - 18 Oct 2007 10:51 GMT
have a look at
http://www.emoreau.com/Entries/Articles/2006/04/The-Treeview-control.aspx

Signature

HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc. (http://www.emoreau.com)
Membre du réseau .NET Expertise  www.dotnet-expertise.com

>I am very new to C#.  I need to create a Windows form that will read a
> SQL table and populate a treeview.  I can connect to the DB, create
[quoted text clipped - 33 lines]
> 18 16 2 15.16.18
> 17 15 1 15.17

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.