VB - Using SaveSetting and GetSetting to store and retrieve data from the Registry
Here is how to use the Registry
' Save text1's value
SaveSetting App.EXEName, "textboxes", "text1", text1.Text
' Get text1's value
text1.text = GetSetting (App.EXEName, "textboxes", "text1", "")
SaveSetting stores the data in the Registry (in HKEY_CURRENT_USER|Software|VB and VBA Program Settings|YourAppName). The four parts of the function are the name under which it is stored (App.EXEName in this case), "textboxes" in this example is like the section name in an ini file, "text1" is like the key in a line of data in the ini file, and text1.text is the value.
GetSetting returns the value. The 4th parameter ("" in this case) is optional and it is the default if no registry entry is found.
It depends on the size of the list. If it's a reasonably small list you could combine the data in a string separated by some unusual character and store it in one registry entry. Otherwise you should use a database or textfile to store the data.
Have you ever tried saving to a registry in a Windows CE device.... i'm actually usine Embedded CE 3.0 which is very similar to vb6, but there are some differences.....i tried your code but it didn't recognize savesettings must be something similar with a ce device
Re: VB - Using SaveSetting and GetSetting to store and retrieve data from the Registry
Originally posted by MartinLiss Here is how to use the Registry
' Save text1's value
SaveSetting App.EXEName, "textboxes", "text1", text1.Text
' Get text1's value
text1.text = GetSetting App.EXEName, "textboxes", "text1", "")
SaveSetting stores the data in the Registry (in HKEY_CURRENT_USER|Software|VB and VBA Program Settings|YourAppName). The four parts of the function are the name under which it is stored (App.EXEName in this case), "textboxes" in this example is like the section name in an ini file, "text1" is like the key in a line of data in the ini file, and text1.text is the value.
GetSetting returns the value. The 4th parameter ("" in this case) is optional and it is the default if no registry entry is found.
Re: VB - Using SaveSetting and GetSetting to store and retrieve data from the Registry
I am trying to get the value of a checkbox that i have compiled in an exe.
This Function is in an activex component. It calls the form and checks the value that should be by default turned on in my exe. However, i seem to be having some trouble getting the value. Reading this post i thought the code below will give me the value of either 1 or 0 but that doesnt seem to be the case.
' I dont seem to be getting anything here
'Using this code AValue = GetSetting("TestSSvr", "checkboxes\frmdvan", "chkA", vbUnchecked) I get a 0 all the time????
'==========Here is the code that saves the value in my exe to the registry 'of the checkbox.This code works in loading the value from the registry and saving to it. But i dont seem to be able to get the value from my active x component when i call it(^Above)
will look in the Registry for HKEY_CURRENT_USER|Software|VB and VBA Program Settings|TestSSvr|checkboxes\frmdvan|frmdvan and if it doesn't find that entry it will return the string vbUnchecked because you have that value in quotes. If you aren't aware vbUnchecked is a built-in VB constant with a value of 0, so if you want to use it with your checkbox you should remove the quotes.
If that doesn't fix your problem you should use regedit and look for HKEY_CURRENT_USER|Software|VB and VBA Program Settings and see if it has a sub-folder named TestSSvr (and/or whatever your exe name is) and see what values are stored in that/those subfolders.
Re: VB - Using SaveSetting and GetSetting to store and retrieve data from the Registry
The following code is in a class module in a dll :
I have a dll that makes a call to get a checkboxes value from my registry.
However i keep getting a 0 which i think is the default value or a vbUnchecked value. What am i doing wrong?
visual basic code:--------------------------------------------------------------------------------Public Function GetAuditValue() As Variant
End Sub--------------------------------------------------------------------------------
I use this code to get the checkboxes registry value when form loads from registry....
visual basic code:--------------------------------------------------------------------------------Private Sub Form_Load()
Re: VB - Using SaveSetting and GetSetting to store and retrieve data from the Registry
Have you ever looked inside the Registry? If not then do Start|Run|Regedit and you will see something that looks similar to Windows Explorer. One of the first "folders" will be HKEY_CURRENT_USER. One of it's "sub-folders" will be "Software", etc.