-
Hi,
this may be a dumb question but...
When you create a VB application which allows the end user to save different options or preferences as to how certain functions should operate, is it possible to save the information directly to the VB app or do you have to tie a database to it in order to be able to save the user settings?
I would tend to think that it is the later because you probably can't alter an app that's been compiled but at the same time, it seems over kill to tie a database to an application just to save 1 or 2 user settings..
Any help would be appreciated..
Dan
-
If you mean actually modifying the data in the app's .exe, why would you want to? Save your settings to the registry or an ini file. There should never be a reason to modify the .exe, and you really shouldn't.
-
The easiest way is to just save values into the registry. There are APIs that can do this for you (if you wish to save a number of different types), but the easiest way is to use the built in registry functions found in VB. They would look like this:
Code:
'Set a registry value
[app name] [section] [key] [string value]
SaveSetting "App1", "Section1\Settings", "Settings", "user"
[string] [app name] [section] [key]
sValue = GetSetting("App1", "Section1\Settings", "Settings")
Or you could save values into an ini file. For info on that, just search vbworld. They have a decent registry/ini module that you can use.
Hope this helps.
-
Great, thanks for the help guys!!! I just needed someone to point me in the right direction.. I figured there had to be a better way than having to tie a database to the app.. I had totally forgotten about INIs and Registry..
Thanks again,
Dan