前端之家收集整理的这篇文章主要介绍了
XML 格式文件读取,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1 Imports System.Xml
2 Private Sub btnReadXML_Click(sender As Object,e As EventArgs) Handles btnReadXML.Click
Dim xmlDoc As XmlDocument = New XmlDocument()
Dim xmlPath As String = "C:\Users\IBM_ADMIN\Documents\Visual Studio 2012\Projects\MVVMTest\WinTest\config\PruVbApp.NB.config"
xmlDoc.Load(xmlPath)
Dim xmlNodeList As XmlNodeList = xmlDoc.GetElementsByTagName("add")
For Each node As XmlNode In xmlNodeList
Dim key As String = node.Attributes("key").Value
Select Case key
Case "CONN_DBSERVER"
MessageBox.Show(node.Attributes("value").Value)
Case Else
End Select
Next
End Sub
<pre name="code" class="html">