Might anyone be able to assist me with writing a (hopefully) simple program to generate an "outline" of successively imbedded nodes, ideally for Visual Basic 2005? Although the recursive technique is the part I'm wrestling with (and thus could probably figure out the rest) the ideal input would be a global one dimensional array containing the number of nodes at each level (0=stop), for instance level[4]=3,2,1,0 would generate the following text/node tree (minus the leading dots, which merely denote indentation)
1.
...1.1
......1.1.1
...1.2
......1.1.2
2.
...2.1
......2.1.1
...2.2
......2.2.1
3.
...3.1
......3.1.1
...3.2
......3.2.1
As yet I haven't figured out how to add child nodes directly using VB 2005, but defining a variable as type "TreeNode" and then adding nodes successively works, but if anyone knows how to do this more directly, please let me know. (I've noticed there are additional 'overload' parameters allowed in the 'Add' command, but I haven't been able to make them work for this purpose.)
Dim rootNode, childNode as TreeNode
Dim rootName, childName as String
rootName="1"
childname="1.1"
rootNode=TreeView1.Nodes.Add(RootName)
childNode=rootNode.Nodes.Add(childName)
Finally, does anyone know how to set individual node text color in VB 2005?
Thanks much,
Chris
1 6978
1.
...1.1
......1.1.1
...1.2
......1.2.1
2.
...2.1
......2.1.1
...2.2
......2.2.1
3.
...3.1
......3.1.1
...3.2
......3.2.1
my quick solution returns the above.. -
-
Dim Levels As Int32 = 3
-
Dim c1 As Int32 = 1
-
Dim c2 As Int32 = 2
-
-
For loopy As Int32 = 1 To Levels
-
Dim RootNode As New TreeNode
-
RootNode = tv.Nodes.Add(loopy.ToString)
-
RootNode.ForeColor = Color.Red
-
For i2 As Int32 = 1 To c2
-
Dim ChildNode2 As New TreeNode
-
ChildNode2 = RootNode.Nodes.Add(loopy.ToString & "." & i2.ToString)
-
ChildNode2.ForeColor = Color.Blue
-
-
For i3 As Int32 = 1 To c1
-
Dim ChildNode3 As New TreeNode
-
ChildNode3 = ChildNode2.Nodes.Add(loopy.ToString & "." & i2.ToString & "." & i3.ToString)
-
ChildNode3.ForeColor = Color.Green
-
Next
-
Next
-
Next
-
-
tv.ExpandAll()
-
-----------------------------------------------------------------------------
Might anyone be able to assist me with writing a (hopefully) simple program to generate an "outline" of successively imbedded nodes, ideally for Visual Basic 2005? Although the recursive technique is the part I'm wrestling with (and thus could probably figure out the rest) the ideal input would be a global one dimensional array containing the number of nodes at each level (0=stop), for instance level[4]=3,2,1,0 would generate the following text/node tree (minus the leading dots, which merely denote indentation)
1.
...1.1
......1.1.1
...1.2
......1.1.2
2.
...2.1
......2.1.1
...2.2
......2.2.1
3.
...3.1
......3.1.1
...3.2
......3.2.1
As yet I haven't figured out how to add child nodes directly using VB 2005, but defining a variable as type "TreeNode" and then adding nodes successively works, but if anyone knows how to do this more directly, please let me know. (I've noticed there are additional 'overload' parameters allowed in the 'Add' command, but I haven't been able to make them work for this purpose.)
Dim rootNode, childNode as TreeNode
Dim rootName, childName as String
rootName="1"
childname="1.1"
rootNode=TreeView1.Nodes.Add(RootName)
childNode=rootNode.Nodes.Add(childName)
Finally, does anyone know how to set individual node text color in VB 2005?
Thanks much,
Chris
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Saradhi |
last post by:
Hi All,
Here I am facing a performance problem with the TreeView Node renaming.
I am displaying a hierarchy Data in a treeview in my Windows C# Application.
My tree view represents an...
|
by: JustinG |
last post by:
I am relativley new to C#, and I am trying to write code using the compact framework, that will allow a handheld user to hit enter while a treeview node is selected, which will then do something...
|
by: Tim |
last post by:
Hi
I have a form with a treeview on it. When I select a particular node it
adds/shows a tab on the form. The treeview node remains selected as it
should. The user can close the tab or remove the...
|
by: Yavuz Bogazci |
last post by:
Hi,
i have created a treeview and this works nice. I have now
a problem: I want to store 2 more Information to each
Treeview Node like UserID and CompanyID. How can i do
that?
Thanks
Yavuz...
|
by: Don Wash |
last post by:
Hi There!
I'm using VB.NET to create a TreeView application and unfortunately I could
not find "Key" property in Node items of the TreeView.
We used to have "Key" property in TreeView node...
|
by: Christian Rühl |
last post by:
heyho, guys! here's another question for you now:
i built an iterator to get all the nodes with a certain attribute in an
xml dom. it all looks like this (i'm using .NET framework 1.1)
...
|
by: watsod1 |
last post by:
Hello,
This is my first post, Hello to all. This also a test post to make sure that I am doing the right thing and following rules etc.
I have been searching for a way to make the treeview...
|
by: Michael_Burgess |
last post by:
Hi there,
I've looked around the different groups and still can't figure this
out without resorting to scrappy code............
I want to programtically select and highlight a TreeView node,...
|
by: R.A.F. |
last post by:
Hi,
I would like simulate a mouse click on on of my treeview nodes when my
form opens.
for that i was thinking to use the same simple way as under C++ :
SendMessage(TreeView.Nodes.Handle,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |