Click to See Complete Forum and Search --> : the joyous visual basic
barrywh1te
12-01-2001, 12:44 PM
ive only just started using visual basic for my computing a-level and i am tryin to save a setting in a program, in my case i am tryin to get my program to store a password. i know it is possible to write to files and the registry but i even with the help files i cant work out how to do it.
HELP!
Barry White - the Love Machine (ish)
Prince
12-01-2001, 03:50 PM
My friend you need to learn a lot. Let me just give u some general idea and u can look up the exact commands off the net.
To write files, here are the steps:
1) Open file*
2) Write to file
3) Close File
*: You specify how you want to open the file. There are three methods. Read 'em in help file.
To write to registry, simplest way to use is API. in short, API are the functions provided to you by Microsoft. You only pass the values and it does it for you. (The actual syntax is lil more copmlicated than syntax, be warned this is considered advanced programming)
barrywh1te
12-04-2001, 02:21 PM
thanks prince i was lookin for a particular command like "object.savetofile" or summat but i got it working now
http://www.sharkyforums.com/ubb/smile.gif
hobbes2112
12-06-2001, 02:40 PM
Originally posted by Prince:
My friend you need to learn a lot. Let me just give u some general idea and u can look up the exact commands off the net.
To write files, here are the steps:
1) Open file*
2) Write to file
3) Close File
*: You specify how you want to open the file. There are three methods. Read 'em in help file.
To write to registry, simplest way to use is API. in short, API are the functions provided to you by Microsoft. You only pass the values and it does it for you. (The actual syntax is lil more copmlicated than syntax, be warned this is considered advanced programming)
for anyone else reading this...heed the warning writing to the REg is a pain without API
------------------
Why Yes! I am (http://www.geocities.com/bloodred716/hobbes2112.html) a proud member of the SF Linux Hippy Club (http://www.geocities.com/bloodred716/hippy.html).
sajidraza
12-11-2001, 11:33 PM
Microsoft has a COM object (you have to search for it) specifically written to address Registry access in VB. Go to msdn.microsoft.com and perform a search. If nothing turns up use the Win32 API functions for registry manipulation through VB.
ksuohio
12-12-2001, 09:35 PM
I used this in one of my VB programs to save a string to the registry and then retrieve it:
SaveSetting "Device Tracker 2001", "Startup", "Database Location", strFileLocation
strFileLocation = GetSetting("Device Tracker 2001", "Startup", "Database Location", strDefaultFileLocation)
Basically, I was saving a string that pointed to the locations of a database that I was using inside the VB program. Basically, the first part is the name of the app, followed by the group, and then the string name. SaveSetting, saves the data to the registry, and the GetSetting retrieves the data. I think it's pretty straight forward. The only thing that I would hestitate on is storing a password in an unencrypted state such as in the registry. Anyone with Windows savy can find the password.
------------------
-Athlon AMD XP 1600+
OC at 1524 mhz 145 fsb
-Abit KG7 - Raid
-512mb Registered DDR Ram
-GeForce3 Ti 200
OC at 220/500
-DVD
-Sony CDRW
-13 Gig IBM HD
-SoundBlaster 16 PCI
-Good 'Ole Dell Keyboard
-MS IntelliMouse
-19" Trinitron Monitor
-Home Audio/Video Speaker System
-RoadRunner Cable Internet
-Windows XP Pro