【问题标题】:Treeview not finding parent node when adding child node添加子节点时Treeview找不到父节点
【发布时间】:2013-04-16 11:45:01
【问题描述】:

所以我有这个 Treeview,我手动添加了一些项目。 可以毫无问题地添加父节点,但是当我想将子节点添加到我通过键搜索的父节点时,由于某种原因它失败了。

这是代码:

tvConstantGroups.Nodes.Add("Boekhouding")
tvConstantGroups.Nodes("Boekhouding").Nodes.Add("Exact") 'These 2 lines fail
tvConstantGroups.Nodes("Boekhouding").Nodes.Add("BoB")

我收到的错误消息是节点“Boekhouding”不存在(NULL / Nothing

【问题讨论】:

    标签: vb.net treeview nodes


    【解决方案1】:
    tvConstantGroups.Nodes.Add("Boekhouding", "Boekhouding")
    tvConstantGroups.Nodes("Boekhouding").Nodes.Add("Exact", "Exact")
    tvConstantGroups.Nodes("Boekhouding").Nodes.Add("BoB", "Exact")
    

    Nodes.Add的第一个参数是Text不是节点的名字

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-20
      • 2017-12-29
      • 1970-01-01
      • 2011-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多