VB.NET2008 随时读取最新config文件的实现方法
需要注意的是: 在debug的方式下,目录debug中有两个编译后的config文件, XXX.vshost.exe和xxx.exe.config 1. 想debug的方式下确认的结果的话,需要改这个config文件: XXX.vshost.exe 而不是这个文件 : xxx.exe.config 2.想bin的方式确认的话,就简单了。 直接修改: XXX.exe.config 就可以。 以下为代码 Dim objConfigurationManager As ConfigurationManager Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Sub readConfig(ByVal flg As Integer) ' 1时刷新此配置文件内容 使用.RefreshSection来重载config文件 Dim str As String = "" Debug.WriteLine(str) MsgBox(str)
End Class (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |