获取配置文件所在路径
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
读
Public Function getServers() As String
Dim xmldoc As XmlDocument = New XmlDocument
Dim path As String = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
xmldoc.Load(path + "\springlandApp.config")
Dim node As XmlNode = xmldoc.SelectSingleNode("configuration/servers")
Return node.InnerText
End Function
写
Public Sub setServers(ByVal serverpath As String)
Dim xmldoc As XmlDocument = New XmlDocument
Dim path As String = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\springlandApp.config"
xmldoc.Load(path)
Dim node As XmlNode = xmldoc.SelectSingleNode("configuration/servers")
node.InnerText = serverpath
xmldoc.Save(path)
End Sub