October 18, 2018
Hot Topics:

Intermediate Page Three

  • November 20, 2002
  • By Karl Moore
  • Send Email »
  • More Articles »

Reading and Writing the Registry

You can read and write to the registry using SaveSetting() and GetSetting().

Here's an example of writing:

Call SaveSetting(App.Title, "UserDetails", _"Name", "Micky")

And reading:

MsgBox GetSetting(App.Title, "UserDetails", "Name")

Here's the syntax for each method:

Call SaveSetting(ApplicationName, SectionName, _KeyName, Value)
MsgBox GetSetting(ApplicationName, SectionName, _KeyName[, DefaultValue])

You can delve into the registry and view your stored values by running regedit.exe but do so with caution and be careful not to delete anything you shouldn't!

-- Anne Keitgen, Germany.

Create a Directory

Did you know Visual Basic has a built-in command to create a directory? For instance, to create the directory 'vbworld', run this:

MkDir ("c:\vbworld\")

-- Dr *.DOS, Hotmail.

Neat Code Tips

Hey fellow VB guys and gals, don't forget that you don't always have to start a new line to run a separate line of code just use the colon (:).

For example, this is interpreted as two lines of code yet takes up less room in the code window. It's great for compacting If-Then-Else statements, etc.

MsgBox "Happy Birthday": MsgBox "To Me"

-- Brad Windsor, Pittsburgh.

Well, that concludes this second selection of top code tips and tricks - check back next week for our third and final instalment!

Page 4 of 4

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.


Thanks for your registration, follow us on our social networks to keep up-to-date