WinCE 中操作配置文件

获取配置文件所在路径

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

 

posted @ 2009-07-14 15:51  TNTZWC  阅读(959)  评论(0编辑  收藏  举报