Solved

Create a TreeView using C#

Posted on 2008-06-20
2
1,024 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 200 total points
ID: 21836044
0
 
LVL 13

Accepted Solution

by:
sm394 earned 300 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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