I am using vb.net 2005 Express Edition.
Application Settings would be a very useful thing, as a global program database
that persists; if only it would work! Does anyone know a hack or a work-around
to get it working?
For me, it seems to mess up the path of the folder where user.config is saved.
If I Access the property :--
System.Windows.Forms.Application.LocalUserAppDataP ath
I get the path :--
C:\Documents and Settings\Steve\Local Settings\Application
Data\TestSettings\TestSettings\1.0.0.0
So, far, so good.
When I _start_ my simple program "TestSetting", (in the development
environment), this path is created.
My prog modifies the Application data then exits. At this stage, the folder
\1.0.0.0 remains empty and nothing is saved.
The Application Data should be saved automatically as user.config as
"SaveMySettingsOnExit" is set True.
I can force a save by putting My.Settings.Save() in a "FormClosed" event.
As before, the above path is created when the form opens. When the form closes
another new path is created :-
C:\Documents and Settings\Steve\Local Settings\Application
Data\TestSettings\TestSettings.vshost.exe_Url_fjhp mbnnff0bekbzchwj1qyrrslcm5tz\1.0.0.0
(The gibberish bit changes if I delete the folder and try again; the
..vshost.exe_Url_ part remains).
User.config is in this new wacky folder; on the next program run the data is
fetched from there and persists okay.
--------
If I run the release version of my code it is the same, except the 2nd path
created is now :-
C:\Documents and Settings\Steve\Local Settings\Application
Data\TestSettings\TestSettings.exe_Url_22ttqho3h30 hjk4oc1nrv02qvlafq5ql\1.0.0.0
(I don't have the "vshost" bit now).
Because vb confuses itself over the path, the synchronize function no longer
works on the Application Settings screen. I get the error "No user.config files
were found in any of the following locations:" - but no list of locations.
--------
If I use Application Settings in a more complex program, it is even more
problematic - I have to include My.Settings.Save(), but some items are saved
but others omitted in the User.config file.
Does anyone else encounter this?
Steve.
--
Posted via a free Usenet account from http://www.teranews.com