Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I store a value in a program

Posted on 2004-04-29
5
Medium Priority
?
259 Views
Last Modified: 2010-05-02
Let's say I want to have a user install a path e:\somefolder for use in my vb program...  Without writing an outside config file is there a way to store the value in the program permanently, or until it is changed again?
0
Comment
Question by:John Gates, CISSP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 1200 total points
ID: 10949164
0
 
LVL 19

Assisted Solution

by:Shauli
Shauli earned 800 total points
ID: 10949195
You can use the registry, like this:

To save in the registry:
SaveSetting your app name", "Startup", "dbPath", yourNewValue

To read from the registry:
Dim myValue as Variant
myValue  = GetSetting("your app name", "Startup", "dbPath", "your default value")

where default value is in affect when the key is not yet there, as in first installation.

These keys are stored at  HKEY_CURRENT_USER > Software > VB And VBA Program Settings > your appname

Keep in mind that these values are PER USER on the local machine.

S
0
 
LVL 14

Expert Comment

by:ajexpert
ID: 10949260
Hi dimante,
  The other way is to store the path in INI file.  When the program is first loaded it first reads the INI file.  You have the flexibilty to change the path in INI file.  Just open the file and change the path.

  Hope this helps.
0
 
LVL 18

Author Comment

by:John Gates, CISSP
ID: 10949571
Thank you!  That does it :-)
0
 
LVL 9

Expert Comment

by:dancebert
ID: 10949601
No, at least not in a pure VB solution.

What would storing the info inside a program file accomplish?  What is the real problem you're trying to solve?  There are several ways to store data in a seperate file.  Each has it's pros and cons.  If we knew why you wanted to store it inside the program file, we could help you pick one of the alternatives that will solve your problem.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

596 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