[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

programming with the registry


i'm interested in finding out about programming with the windows registry.  Does anyone know of a good general guide to using it from VB - and most importantly - what contraints there are?  i.e. I assume we're not meant to put massive amounts of information in the registry - if everyone did that it would get unstable pretty quickly wouldn't it?

is there a limit to what we should store in the registry?  Is there a guide to "good programming practices" for the registry anywhere that anyone knows of?


  • 2
1 Solution
VB comes with some simple registry readers and writers, for example:

SaveSetting "AppName", "Section", "Key", "Data"
ThisSetting = GetSetting"AppName", "Section", "Key")

this has a limitation, because keys using these built-in functions are only ever stored beginning at this location:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings

if you want to be able to read/write keys to/from different locations, you can do a private declare to a win32 api call within VB.

some general guidelines for registry:

- store user specific data (or machine-specific) for your app in the registry. if you must store more than 50 pieces of data, it's usually best to implement a text file or DB, so as not to clog up the registry.
small error above. should be:

ThisSetting = GetSetting("AppName", "Section", "Key")

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now