树视图子节点错误 [英] Tree View child nodes error
问题描述
当我在c#中使用以下代码时,它会给出错误
When i use the following code in c# it gives error
parent.ChildNodes.Add(child);
nParent.PopulateOnDemand = true;
错误15'System.Windows.Forms.TreeNode'不包含'ChildNodes'的定义,没有扩展方法'ChildNodes'接受类型为'System.Windows.Forms.TreeNode'的第一个参数'(你是否缺少using指令或汇编引用?)
错误3'System.Windows.Forms.TreeNode'不包含'PopulateOnDemand'的定义,并且没有扩展方法'PopulateOnDemand'接受类型为'System.Windows.Forms.TreeNode'的第一个参数'可能是发现(你错过了使用指令或汇编参考吗?)
帮我........ .....
Error 15 'System.Windows.Forms.TreeNode' does not contain a definition for 'ChildNodes' and no extension method 'ChildNodes' accepting a first argument of type 'System.Windows.Forms.TreeNode' could be found (are you missing a using directive or an assembly reference?)
Error 3 'System.Windows.Forms.TreeNode' does not contain a definition for 'PopulateOnDemand' and no extension method 'PopulateOnDemand' accepting a first argument of type 'System.Windows.Forms.TreeNode' could be found (are you missing a using directive or an assembly reference?)
Help Me.............
推荐答案
尝试:
Try:
parent.Nodes.Add(child);
根据MSDN,该属性被称为节点 [ ^ ]而不是ClildNodes
http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.aspx [ ^ ]
According to MSDN, the property is called Nodes [^]and not ClildNodes
http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.aspx[^]
这篇关于树视图子节点错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!