TreeNode myTree;
for (int i = 0; i < 10; i++)
{
myTree = new TreeNode("父节点" + i);
this.tvOne.Nodes.Add(myTree);
TreeNode myNode = new TreeNode();
for (int j = 0; j < 5; j++)
{
myNode = new TreeNode("子节点" + j);
myTree.Nodes.Add(myNode)
}
}
TreeView动态忝加类似如此,看你具体要忝加什么,里面的变量再具体改。