我天天山好多呢
你在电脑上每一步 *** 作在C盘中都有相应的文件建立等等
你新建个文件C盘都有个指针就是.bak格式的
你的xml文字有错误,正确的如下:<?xml version="1.0"?>
<grouplist>
<group name="1">
<server name="1.1"/>
<server name="2.2"/>
</group>
<group name="2">
<server name="2.1"/>
<server name="2.2"/>
</group>
</grouplist>
以下是在vs2008下调试成功
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tvw As TreeView
Dim x As New Xml.XmlDocument
Dim nd As Xml.XmlNode
Dim pcnd As TreeNode
Dim I As Integer
Dim II As Integer
tvw = New TreeView
tvw.Parent = Me
tvw.SetBounds(10, 10, 300, 300)
x.Load("该处为xml文件路径") '如 C:\abc.xml
For I = 1 To x.DocumentElement.ChildNodes.Count
nd = x.DocumentElement.ChildNodes(I - 1)
pcnd = tvw.Nodes.Add("G" &I.ToString, nd.Attributes(0).Value)
For II = 1 To nd.ChildNodes.Count
pcnd.Nodes.Add(nd.ChildNodes(II - 1).Attributes(0).Value)
Next
pcnd.Expand()
Next
End Sub
End Class
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)