Solved

Registry Question

Posted on 2000-02-23
2
129 Views
Last Modified: 2010-05-02
How do I programmatically add a key to the "VB and VBA Program Settings" key?  Please provide the code that will perform this task.
0
Comment
Question by:jasonboetcher
2 Comments
 
LVL 3

Accepted Solution

by:
paulstamp earned 15 total points
ID: 2550870
This is an example from my clsPreferences used to record settings in the registry

Public Property Let AlwaysConnect(ByVal bValue As Boolean)
    Call SaveSetting(m_sAppName, "Prefs", "AlwaysConnect", bValue)
   
End Property

Public Property Get AlwaysConnect() As Boolean

    AlwaysConnect = GetSetting(m_sAppName, "Prefs", "AlwaysConnect", "True")
   
End Property
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2550875
Use the VB SaveSetting statement like this:

SaveSetting Statement Example
The following example first uses the SaveSetting statement to make entries in the Windows registry (or .ini file on 16-bit Windows platforms) for the MyApp application, and then uses the DeleteSetting statement to remove them.

' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
            key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
' Remove section and all its settings from registry.
DeleteSetting "MyApp", "Startup"
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question