MyException - 我的异常网
当前位置:我的异常网» C# » xml资料的读取 并在Treeview控件上显示

xml资料的读取 并在Treeview控件上显示(3)

www.MyException.Cn  网友分享于:2013-12-20  浏览:90次

End If
'值是否为空
If aValue = " " Then
Node.RemoveChild(Ele)
Else
Ele.InnerText = aValue
End If
End If
Catch ex As Exception
Debug.Print(ex.Message)
Return False
End Try
End If
XmlDoc.Save(XmlFile)
Return True
End Function

Public Function Read(ByVal aSection As String, ByVal aKey As String, Optional ByVal aDefaultValue As String = " ") As String
Dim Node As XmlNode
Node = XmlDoc.DocumentElement.SelectSingleNode(aSection & "/ " & aKey)
If Node Is Nothing Then Return aDefaultValue
Return Node.InnerText
End Function

End Class
------解决方案--------------------
DataSet ds=new DataSet();
ds.ReadXml(strXml);
foreach(DataRow r in ds.Tables[0].Rows)
{
tree.Nodes.Add(r[0]);
DataRow[] rows=ds.Tables[0].Select( "group= ' "+r[0]+ " ' ");
foreach(DataRow row in rows)
tree.Nodes[tree.Nodes.Count-1].Nodes.Add(row[1]);
}
------解决方案--------------------
32486802

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有