1

我正在尝试从 XML 文件制作 TreeView,但验证后出现错误(粗线):“不是数组或索引器”。

将 NavBarPath 调暗为字符串;

将 xDoc 暗淡为 System.Xml.XmlDocument;

暗淡 fs 作为 System.IO.FileStream;

将 xRoot 暗淡为 System.Xml.XmlElement;

将 xnode 暗淡为​​ System.Xml.XmlNode;

将根节点暗淡为 System.Windows.Forms.TreeNode;

NavBarPath = InTouch:InTAppDir + "NavBar.xml";

xDoc = new System.Xml.XmlDocument();

fs = new System.IO.FileStream(NavBarPath, FileMode.Open, FileAccess.Read);

xDoc.Load(fs);

xRoot = xDoc.DocumentElement;

对于 xRoot 中的每个 xnode

rootnode = new System.Windows.Forms.TreeNode(xnode.Attributes["Name"].Value);

...

下一个;

4

0 回答 0