Adding childs to a treenode dynamically in c#

后端 未结 2 440
面向向阳花
面向向阳花 2021-01-14 02:07

I want to dynamically add some child nodes to a root node in my TreeView. I have a string Array of some names like {\"john\", \"sean\", \"edw

2条回答
  •  爱一瞬间的悲伤
    2021-01-14 02:42

    I think the problem is that you do not inform the mainNode that child is its children, something like: mainNode.Children.Add(child) (in the for block). You just create the child node, but you don't do anything with it for it to have any relation with the TreeView or with the mainNode.

提交回复
热议问题