troubleshooting Question

User Settings not saved

Avatar of Mutsop
MutsopFlag for Belgium asked on
.NET ProgrammingC#Visual Basic.NET
7 Comments1 Solution885 ViewsLast Modified:

I have a few user and application settings in my program.
The user settings are the following:

InvoiceSaveMap as String
TemplateOpenMap as Specialized.StringDictionary

When I try to save these 2 only the InvoiceSaveMap saves... and the user.config (in the Application Data folder) gets updated. The TemplateOpenMap on the other hand doesnt get saved but in the same session I am able to rertieve the inputs which is weird as the values can't be found in the user.config (lets say its empty)

<?xml version="1.0" encoding="utf-8"?>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="Bollaert.Winforms.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
            <setting name="TemplateOpenMap" serializeAs="Xml">
                <value />
            <setting name="InvoiceSaveMap" serializeAs="String">

(both settings start empty)
This is my code:
If My.Settings.TemplateOpenMap Is Nothing Then
                My.Settings.TemplateOpenMap = New Specialized.StringDictionary
            End If
            If Not My.Settings.TemplateOpenMap .ContainsKey(TextBoxSubPad.Text) Then
                My.Settings.TemplateOpenMap .Add(TextBoxSubPad.Text, TextBoxSynonym.Text)
                MessageBox.Show("Directory already listed")
            End If

No errors are listed when I compile/run this. But for some reason the TemplateOpenMap  doesnt get saved.

Any ideas?
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros