|
-
Aug 17th, 2001, 12:08 AM
#1
Thread Starter
New Member
Using ini or registry
Hello,
I need to make use of the registry or ini files in order to store basic user data.
I am using VB6, and I had problems fetching sample code about doing this.
Any help will be greatly appreciated.
Yours,
Vlad.
-
Aug 17th, 2001, 12:20 AM
#2
Registered User
Reading and writing data to and from the registry is easy.
VB in fact uses HKEY_CURRENT_USER\SOFTWARE\VB AND VBA PROGRAM SETTINGS\app name
to store and retrieve data using savesetting and getsetting
VB Code:
Option Explicit
Private Sub Command1_Click()
'create new registry settings
SaveSetting "test reg app", "users\user1", "Name", "Paul"
SaveSetting "test reg app", "users\user1", "Location", "Woolloomooloo"
End Sub
Private Sub Command2_Click()
'get at the registry settings
MsgBox GetSetting("test reg app", "users\user1", "name")
MsgBox GetSetting("test reg app", "users\user1", "location")
End Sub
Private Sub Command3_Click()
'Delete the registry settings
'DeleteSetting "test reg app", "users\user1", "name" 'delete a key
DeleteSetting "test reg app", "users" 'delete beneath test reg app\users
'DeleteSetting "test reg app" 'delete all beneath test reg app
End Sub
This site has a few good tutorial on the registry too:
[url]http://www.vb-world.com/registry/[/url]
-
Aug 17th, 2001, 12:22 AM
#3
Using registry:
VB Code:
dim opt_Username as string
opt_Username="Eddie"
SaveSetting "MyApp", "UserInfo", "Username", opt_Username
opt_UserName=GetSetting("MyApp","UserInfo","Username","JohnDoe")
msgbox "Now check your registry!"
-
Aug 17th, 2001, 12:23 AM
#4
Hyperactive Member
I prever registry cuz no one bother missing with the registry...anyways, I added a molude that let's you use the registry...to add something to the registry, use the following code:
VB Code:
Private Sub Command1_Click()
SaveSettingString HKEY_CURRENT_USER, "Software\App", "String Title", "String information"
End Sub
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|