CodeItBetter Programming Another VB Programming Blog

Save and retrieve registry settings.

Posted on July 16, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
'Registry - Save and retrieve registry settings.
'Variant to hold 2-dimensional array returned by GetSetting.
Dim MySettings As Variant    ' Unused in the example. Not sure why it's there.
' Place some settings in the registry.
' Saves the Top and Left position of a form, so that it starts in the right place
SaveSetting "MyApp", "Startup", "Top", 75    ' app name, key name, Value
SaveSetting "MyApp", "Startup", "Left", 50
' prints out what you''ve written
' in GetSettings, if a value isn't found, you can specify a default.
' in this case, left isn't found, so 25 is the default
Debug.Print GetSetting(appname:="MyApp", section:="Startup", Key:="Left", Default:="25")
' and this deletes both settings, in case you want to re-write them
DeleteSetting "MyApp", "Startup"
Filed under: Registry Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.