WriteProfileString in vb.net under XP - where is the data stored?

  • Thread starter Thread starter Bob S
  • Start date Start date
B

Bob S

I have been working with a vb program which I converted to vb.net using
Visual Studio 2008. I have been using GetProfileString and
WriteProfileString to save settings between runs of the program. In one case
I want to be able to get rid of some settings. In one posting if was
suggested that

WriteProfileString(Appname, KeyName, 0&)

using the declare:
Declare Function WriteProfileStringA% Lib "Kernel32" (ByVal lpAppName$,
ByVal lpKeyName$, ByVal lpString$)

would do the trick. To check that this is what is actually happening, I
wanted to look at the data before and after. In the old days, the data was
stored in .ini files. More recent articles mention that the data is stored
in the registry. I have been searching the registry and various files
looking for the place the data actually gets stored.

Can someone point me to the correct place to look?

Also if there is a preferred .NET way of reading and writing the profile,
suggestions are welcome.

Thank you for your time
 
Did you look in the win.ini file?

I used the following declaration:

Private Declare Function WritePrivateProfileString Lib "kernel32" _
Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal lpString As String, _
ByVal lpFileName As String) As Integer

This allowed me to specify an explicit file name of the INI file where I
wanted
the setting to be stroed. To specify a location to store them I used the
following:

Environment.SpecialFolder.ApplicationData

I just added the filespec & .ini extension to it. Doing some research I see
that
VB 2008 and possibly previous .NET versions use the Configuration item
to store persistant parameters, but I chose to use the old INI text file
scheme
because tech support likes going into users' PCs and making changes to the
settings. Regards, Saga
 
Back
Top