Re: Treeview add node as Child by Peter
Peter
Thu Dec 08 15:30:02 CST 2005
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==]
"Elmo Watson" <sputnik75043@No.Spam.Yahho.com> wrote in message
news:u1di4cD$FHA.4028@tk2msftngp13.phx.gbl...
> 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?
>
> "Lloyd Sheen" <sqlguyremoveallofthis@tostopspamhotmail.com> wrote in
> message news:aaydnaQoX9QSCgXeRVn-tg@rogers.com...
>> 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
>>
>> "Elmo Watson" <sputnik75043@No.Spam.Yahho.com> wrote in message
>> news:uhjMjUD$FHA.4012@TK2MSFTNGP10.phx.gbl...
>>> 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?
>>>
>>>
>>
>>
>
>