Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create a TreeView using C#

Posted on 2008-06-20
2
Medium Priority
?
1,026 Views
Last Modified: 2008-06-21
I need some help with a C# problem. I have a database that has three tables in it:

ServerStatus
Server
Database

What I want to do is create a TreeView that looks like this:

- Server Status
  - Server
    - Database

eg.

- Online
  - ApplicationServer20
    - AdventureWorks
    - Pubs
    - Northwind
+ Offline
+ Shutdown

Does anyone know how I can implement this?
0
Comment
Question by:computerstreber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Assisted Solution

by:CuteBug
CuteBug earned 800 total points
ID: 21836044
0
 
LVL 13

Accepted Solution

by:
sm394 earned 1200 total points
ID: 21837648
you can add nodes in tree after getting result set from you query like
//--------------------------------------------------------------
foreach (DataRow row in ds.Tables[0].Rows)
                {
                           TreeNode newNode = new TreeNode(row["Column_NAME"].ToString());
                            treeView1.Nodes.Add(newNode);
                     }//end for
//--------------------------------------------------------------------
then you can add further child nodes through Recursive function  
OR
on node click event i.e.
treeView1.SelectedNode.Nodes.Add(newNode);

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question