请教VBnet的“未将对象引用设置到对象的实例”
如下例:DimxmlDocAsNewXml.XmlDocumentxmlDoc.Load("c:\programfiles\wtsystem\config.xml")Di...
如下例:
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("c:\program files\wtsystem\config.xml")
Dim myPcAdress As String
myPcAdress = xmlDoc.SelectSingleNode("configuration")_
.SelectSingleNode("equipment")_
.SelectSingleNode("myComputer")_
.SelectSingleNode("adress")_
.InnerText
例子中最后一句,报错提示“未将对象引用设置到对象的实例”,该怎么改呢?菜鸟求助于高手! 展开
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("c:\program files\wtsystem\config.xml")
Dim myPcAdress As String
myPcAdress = xmlDoc.SelectSingleNode("configuration")_
.SelectSingleNode("equipment")_
.SelectSingleNode("myComputer")_
.SelectSingleNode("adress")_
.InnerText
例子中最后一句,报错提示“未将对象引用设置到对象的实例”,该怎么改呢?菜鸟求助于高手! 展开
2个回答
2016-10-12
展开全部
SelectSingleNode 的用法如下
Module Module1
Sub Main()
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("c:\program files\wtsystem\config.xml")
Dim myPcAdress As String
myPcAdress = xmlDoc.SelectSingleNode("/configuration/equipment/myComputer/adress") _
.InnerText
End Sub
End Module
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询