A
Anatoly
I'm trying to use VB.NET's 2003 ConfigurationSettings.AppSettings.Set()
method of updating values but getting error "Collection is read-only".
How can I change values of keys in the App.config file programatically?
Here is my code:
Imports System.Configuration
Imports System.Collections.Specialized
Module Module1
Sub Main()
Dim sAttr As String
sAttr = ConfigurationSettings.AppSettings("Key0")
MessageBox.Show(sAttr)
ConfigurationSettings.AppSettings.Set("Key0", "11")
MessageBox.Show(sAttr)
End Sub
End Module
'***********************************************
'App Config File:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Key0" value="00"/>
</appSettings>
</configuration>
'********************************************
-Anatoly
method of updating values but getting error "Collection is read-only".
How can I change values of keys in the App.config file programatically?
Here is my code:
Imports System.Configuration
Imports System.Collections.Specialized
Module Module1
Sub Main()
Dim sAttr As String
sAttr = ConfigurationSettings.AppSettings("Key0")
MessageBox.Show(sAttr)
ConfigurationSettings.AppSettings.Set("Key0", "11")
MessageBox.Show(sAttr)
End Sub
End Module
'***********************************************
'App Config File:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Key0" value="00"/>
</appSettings>
</configuration>
'********************************************
-Anatoly