Add treeview node "manually" as string with PathSeparator as divider in the string

M

Mikael Jansson

Hi,
Is it possible to add a treenode to a treeview by using a string that has
the PathSeparator as divider in the string?
hereis a psedocode (maybe stupid format or coding but I hope you understand
what I mean)

treeview.pathSeparator = "."
[treeview add node] = "1.2.6.1.2.2.4.4.2.1"
[treeview add node] = "1.2.6.2.1.2.4.4.2.1"
"The new node is separated into the tree as this example

1 --
I--2
I--6
I--1
I--2
I--1
... ... ... ... ...and so on

kind regards

/ Mikael
 
J

Jeffrey Tan[MSFT]

Hi Mikael,

Thanks for your post.

Based on my experience, Winform TreeView does not have this as a build-in
function. If you really want to get this function, we have to implement it
ourselves.

Normally, we should inherit from TreeView control, then create a new string
collection property which accept for a collection of strings. For each
string, we can use PathSeparator property to parse the input string
representation. After parsing, we can dynamically add each node into the
TreeView without based on your request.

Additionally, based on your logic, if 2 string node properties have the
same number(string) in the same level(like 1, 2 or 6 in the 2 strings you
provided), you will only create the first one as TreeNode, the second just
reuse the first TreeNode, yes? If it is true, how can we explicit want 2
TreeNodes with the same name in the same level? For example, we want the
structure like this:
1-
|-2
|-6
|-2
.....

How can we get this done? I think our parsing code should resolve this
different meanings scenario.

Hope this helps. Thanks
===========================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Mikael,

Does my reply make sense to you? Is your problem resolved? Please feel free
to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top