|
-
the joyous visual basic
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)
-
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)
-
thanks prince i was lookin for a particular command like "object.savetofile" or summat but i got it working now
-
Hammerhead Shark
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 a proud member of the SF Linux Hippy Club.
-
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.
-
.
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
---------------------------------------------------------------
- Asus M50 Laptop - C2D T9300 - 4 gig RAM - Radeon HD 3650 - Vista x64 Ultimate
- Intel i7-3770K - Asus P8Z77-V DELUXE - 32gig RAM - Radeon HD7970 Ghz - Plextor M3 256GB/120GB OCZ Vertex3
- LG BluRay - Razor Blackwidow Ultimate Keyboard - Logitech G9x
- HP ZR2740w/Asus LCD - W7 Ultimate
---------------------------------------------------------------
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
|
|