Library tutorials & articles
Registry
- Introduction
- Saving Settings
- Getting Settings
Saving Settings
To utilise the registry, VB provides a simple function called SaveSetting. The SaveSetting function uses the following syntax:
SaveSetting AppName, Section, Key, Value, [Default]
Where AppName is the name of your application, Section is the next folder up and Key is the item your value is stored in.
For example, the following code will save the contents of TextBox1 in the registry. You do not need to know this, but the full path would be (if using Win 98)
HKEY_USERSCurrentUserSoftwareVB and VBA Program SettingsAppNameSectionKey
You can take a look at this by clicking Start | Run... and type C:Windows egedit.exe . Then look in the path above. However, if you want to change anything, you should back up the registry first!
The following code saves the value of TextBox1.Text to the registry:
' Save the value in Text Box 1
SaveSetting App.Title, "Default Settings", "Font", TextBox1.Text
NOTE: this value will be stored in the current users 'section' in the registery. Other users can change this value without affecting other users settings
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
this will create a key under hkeylocalmachine\software
named MyFirstKey
and under that key it will set the default subkey to equal c:\progran files\my
and create another key called Example with the value of 1
'Get RegEdit.Server object
Set S = CreateObject("RegEdit.Server")
'Get a key
Set Key = S.GetKey("HKLM\SOFTWARE")
'Add a new key
Set MyKey = Key.CreateKey("MyFirstKey")
'or Set MyKey = Key.SubKeys.Add("MyFirstKey")
'Set String and DWORD values
MyKey.Values("") = "C:\Program Files\My"
S.GetKey("HKLM\SOFTWARE\MYFIRSTKEY").Values("Example")="1"
Does anyone know how to set a Dword value in the registry??
On keydown, set movement to Up.
On keyup, set movement to None.
Then when you press the key, the player moves up, and when you release it they stop. The repeat won't have any effect.
How do you stope the pause after a keypress? For Example, if you have a game where the arrow key's are used and the player is walking by holding down the arrow key, the player will walk a step, pause then continue walkking.
You can test this by opening note pad and hit any key and hold down... notice the pause that occurs be for the key is repeated:
a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
^-Simulated pause
Thanks in advance for any leads!
-DalePeach
You need to use Windows API (see http://www.developerfusion.com/show/1857/)
Yes I tried this too, but you can't access anything outside the VB Registry and the User Restry. How do you access things in the Root or under HKEYLOCALMACHINE\SOFTWARE
? ? ?
I used this fuction it's very good . But can i save my value in some other
foler other than Vb application Folder...
Umesh Bardale
ubardale@yahoo.com
SaveSetting and Gettstting are very fine, but i want to access an registry key not stored with SaveSetting.
(and not in this VBA ... folder.
How can i do this?
Vey Good. Very Helpful.
www.hopkinsprogramming.net/
Hopkins Programming
This thread is for discussions of Registry.