473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview - relative position

forgive me, but I'm fairly new to VB.Net - having only used VB6 in the
past - -
I can easily place a node on the treeview (tv1.nodes.add(key, text)
BUT -
in VB6, we'd add a child node (TV1.NOdes.add...), and in that string, we'd
pick the parent/relative node, so that it would be placed under the correct
node....

How is that accomplished now?
Nov 6 '06 #1
1 2476
Elmo Watson wrote:
I can easily place a node on the treeview (tv1.nodes.add(key, text)
BUT -
in VB6, we'd add a child node (TV1.NOdes.add...), and in that string, we'd
pick the parent/relative node, so that it would be placed under the correct
node....

How is that accomplished now?
In much the same way.

Every TreeNode has a Nodes collection to which you can add [child]
TreeNodes. Annoyingly, in VB'2003, anyway, the Add method seems to
return an Index, not a TreeNode proper, so you have to muck about a
/bit/, as in

Dim oRootNode as TreeNode _
= tv1.Nodes.Add( "Root" )
Dim iIndex as Integer _
= oRootNode.Nodes.Add( "Child 1" )
Dim oChild1 as TreeNode _
= tv1.Nodes( iIndex )

iIndex = oChild1.Nodes.Add( "Grandchild 1" )
Dim oGrandChild As TreeNode _
= oChild1.Nodes( iIndex )

All of which is fine when initially loading the tree, but finding an
item that you've already loaded is a pain, since the TreeView doesn't
have keyed Nodes any more. But it's easy enough to implement your own.

HTH,
Phill W.
Nov 7 '06 #2

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

Similar topics

1
5349
by: Wilhelm Kutting | last post by:
Hi i like to make a complex layout with css. All the content is inside a container div. I like to get the following sequence without the css-layout: logo title mainnav content i can only...
3
19748
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following...
6
14170
by: meh | last post by:
I can figure out the total number of nodes in a given tree but what I'd like to know is what is the Selected Nodes relationship to the entire tree i.e This is node n out of nnn nodes. In most of...
6
6063
by: Gérard Talbot | last post by:
Hello fellow stylers, When trying this page http://www.gtalbot.org/BrowserBugsSection/PercentualRelativePositioning.html I get different rendered layouts with IE 6, IE 7 beta 2, Firefox...
4
4054
by: dropdeadster | last post by:
Trying to line up a tic-tac-toe board type grid of images using style= tags to <img inside a table TD but it's not working, I get more like a set of steps, can I get an explanation of what's wrong...
6
20917
by: PeteCresswell | last post by:
I've just added a new record to the backend DB and reloaded the TreeView that shows the user all records in the DB. Now I want to programatically position the TreeView at the newly-added record...
2
2585
by: Simon Rigby | last post by:
Hi folks, A bizarre problem I am having. I have a treeview which is bound to an XmlDataSource. The XMLDataSource.Data property is set to the result of a function that generates an XML...
2
3571
by: Jenifer.Austin | last post by:
MS Access 2000 I have created a large treeview control based on lists of parts. The nodekey for a part consists of a character followed by the parent part's index. Some of these parts (e.g.,...
10
3242
by: Mark | last post by:
According to my book on CSS, if you apply 'position: relative' to a block-level element, it will stay exactly where it is. However, you can then use top, left etc. to offset the element relative to...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.