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 / WinForm General / December 2005

Tip: Looking for answers? Try searching our database.

Treeview add node as Child

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elmo Watson - 08 Dec 2005 20:22 GMT
with VB6 - to add a node as a child, to a specific node, I'd do something
like:
Tv1.Nodes.Add(Nodes.Add tv1.SelectedItem.Key, tvwChild, newKey, NewName
tv1.SelectedItem.Key was the Parent node -

But - as I'm trying to add something in, using VS.Net 2005 (skipped here
straight from vb6), the hints aren't giving me the same options -

Relative (1st item), and Relationship (2nd option) are not even
available....

where can I find info on how to do this in VS.Net 2005?
Lloyd Sheen - 08 Dec 2005 20:29 GMT
There is a new structure to the API for treeviews.  Each node will have its
own collection of nodes.  This is much easier if you think about it since it
deals with nodes rather than the treeview.  In dot.net V1.+ there is no way
to identify the nodes with a key but this is back in with V2.+.

This means that you get a reference to the node you want as the parent and
then add nodes to that.

Hope this helps.

Lloyd Sheen

> with VB6 - to add a node as a child, to a specific node, I'd do something
> like:
[quoted text clipped - 8 lines]
>
> where can I find info on how to do this in VS.Net 2005?
Elmo Watson - 08 Dec 2005 20:37 GMT
OK - so I want to add a child node to a parent node - -
HOW do I get a reference to the Parent?

I've found you can't even do a 'Dim sNode as Node' anymore - it doesn't like
'as Node'

Is there somewhere else ( a web page, or the like) that has an actual
example of all this?

> There is a new structure to the API for treeviews.  Each node will have
> its own collection of nodes.  This is much easier if you think about it
[quoted text clipped - 20 lines]
>>
>> where can I find info on how to do this in VS.Net 2005?
Peter Oliphant - 08 Dec 2005 21:30 GMT
Each TreeNode has a Parent property. I believe you keep looking at the
parents (i.e., this is my parent, this is my parent's parent, this is my
parent's parent's parent, etc.) eventually you get one that has no parent.
That should be the root node in the TreeView they are attached to (the
refeence you are asking for)...

At least I THINK that's what you asked for... : )

[==P==]

> OK - so I want to add a child node to a parent node - -
> HOW do I get a reference to the Parent?
[quoted text clipped - 30 lines]
>>>
>>> where can I find info on how to do this in VS.Net 2005?

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.