can i change app.config file so that value of key changes when MenuItem gets checked / unchecked

hi , this is my key in the app.config file
<add key="AppendTextBoolean" value="True" />

this is how i read it
Dim bConcatenateOutput As Boolean = System.Configuration.ConfigurationSettings.AppSettings("AppendTextBoolean")

this is the Menu_click event
Private Sub mnuAppendToOutput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAppendToOutput.Click
        If mnuAppendToOutput.Checked = True Then
            mnuAppendToOutput.Checked = False
            System.Configuration.ConfigurationSettings.AppSettings("AppendTextBoolean") = "False"
            mnuAppendToOutput.Checked = True
            System.Configuration.ConfigurationSettings.AppSettings("AppendTextBoolean") = "True"
        End If

    End Sub

can i set the value of the Key to to change, because currently it says it is read only when i try to run the above code
Who is Participating?
RonaldBiemansConnect With a Mentor Commented:
sorry pressed submit to soon :-)

dim ds as new dataset

ds.ReadXml(Application.StartupPath & "\yourexename.exe.config")
ds.Tables(1).Rows(0).Item(1) = "False"
ds.WriteXml(Application.StartupPath & "\yourexename.exe.config")
Hi Jxharding how are you?

yes you can,

something like

dim ds as new dataset

ds.ReadXml(Application.StartupPath & "\yourexename.exe.config")
ds.Tables(1).Rows(0).Item(1) = "False"
jxhardingAuthor Commented:
hi ronald, i'm doing great thanks!

is there an easy way perhaps of reading the value when the application starts?
because currently i'll prob have to read it into a dataset, then make a dataview,sort it / filter it
locate the key i need e.g. MyBoolean , and then set the menu item to checked or not.

thanks for the help!
jxhardingAuthor Commented:
please ignore last comment from myself, it was really stupid of myself. i haven't done this in a while.

thanks for the help again!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.