473,287 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Treeview Node Type

Is there any way when progratically adding nodes to assign them some kind of
type group nodes that want to different things to. I am creating an Explorer
type interface and need to differentiate between folder and file nodes in my
code. Regards, Chris.
May 13 '06 #1
4 1768
You could subclass TreeNode.

Tom Dacon
Dacon Software Consulting

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.

May 13 '06 #2
I'm not sure how you'd do that. Can you point me to any resouces/links?

"Tom Dacon" <td****@community.nospam> wrote in message
news:el**************@TK2MSFTNGP03.phx.gbl...
You could subclass TreeNode.

Tom Dacon
Dacon Software Consulting

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.


May 13 '06 #3
I've done this sort of thing a variety of ways. The most flexibility
and less troublesome in regards to managing parent object references
if you do a bunch of drag and drop of tree nodes is do to
the following.

Create a simple class that has some sort of Guid or Unique ID, an
object name or possibly an enum, and a text description.

Store this object in the TreeNode.Tag property. Whenever
you get the selected node, grab the .Tag

CustomClass rob = (CustomClass)tree.SelectedNode.Tag;

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.

May 13 '06 #4
I can't seem to find the tag property. This is the asp.net v2 treeview. I
use the code below to add the node but I can't do e.g. newnode.tag =
"folder"

Dim newNode As TreeNode = New TreeNode("folder", "folder")

"Robbe Morris [C# MVP]" <in**@eggheadcafe.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
I've done this sort of thing a variety of ways. The most flexibility
and less troublesome in regards to managing parent object references
if you do a bunch of drag and drop of tree nodes is do to
the following.

Create a simple class that has some sort of Guid or Unique ID, an
object name or possibly an enum, and a text description.

Store this object in the TreeNode.Tag property. Whenever
you get the selected node, grab the .Tag

CustomClass rob = (CustomClass)tree.SelectedNode.Tag;

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Chris" <no****@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
Is there any way when progratically adding nodes to assign them some kind
of type group nodes that want to different things to. I am creating an
Explorer type interface and need to differentiate between folder and file
nodes in my code. Regards, Chris.


May 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jeroen Ceuppens | last post by:
Hi, I want to make something that adds a TreeNode to the end of TreeView, that TreeView Looks like + Level 1 + Level 2 + Level 3 - Level last
2
by: George M. | last post by:
I'm working with the treeview control on an ASP.NET page (written in C#), and I have one built the looks something like: Root |_Category1 |_Site1 |_Report1 |_Report2 |_Site2 |_Report3...
7
by: vsiat | last post by:
I am trying to create a treeview out of a database table with the typical structure ID, NAME, PARENTID, TYPE, EXTRA_INFO, where is linked to the . What I want to achieve is create a tree made...
2
by: kevin | last post by:
I would like to remember the state of the nodes after the treeview gets disposed, but not necessarily after the app terminates so I don't need a disk file. I was thinking about using the tag...
1
by: Chris Murphy via DotNetMonster.com | last post by:
Hi all, I'm just wondering if any one can help me with this development issue I'm having. I've created a customized treeview control to handle the particular tasks to which I'll be using it. Within...
7
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file...
1
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file...
0
by: lewis76 | last post by:
I have figured out how to populate a treeview with an xml file however I just can't for the life of me get this formatting of the nodes right. Here's where I'm at: <Season>...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.