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


save settings

Posted on 2003-11-09
Medium Priority
Last Modified: 2010-05-01
is there a way to save a the info that was in the textbox when it closed


a program has a 2 text boxs and they click a command button for save so next time they open the program the 2 text boxs have the same text as when the clicked save command button

Question by:camerononastick
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
  • 2
LVL 28

Accepted Solution

vinnyd79 earned 80 total points
ID: 9711957
if you download the module here:


You can add it to your project and then use something like this to save and retrieve settings:

Private Sub Command1_Click()
' store text from Text1 and Text2
SaveStringSetting "MyAppName", "Settings", "MyText1", Text1.Text
SaveStringSetting "MyAppName", "Settings", "MyText2", Text2.Text
End Sub

Private Sub Command2_Click()
' retrieve text from Text1 and Text2
Text1.Text = GetStringSetting("MyAppName", "Settings", "MyText1")
Text2.Text = GetStringSetting("MyAppName", "Settings", "MyText2")
End Sub
LVL 28

Expert Comment

ID: 9711974
If you want a simpler solution you could just use VB's SaveSetting and GetSetting

Private Sub Command1_Click()
' store text from Text1 and Text2
SaveSetting "MyAppName", "Settings", "MyText1", Text1.Text
SaveSetting "MyAppName", "Settings", "MyText2", Text2.Text
End Sub

Private Sub Command2_Click()
' retrieve text from Text1 and Text2
Text1.Text = GetSetting("MyAppName", "Settings", "MyText1")
Text2.Text = GetSetting("MyAppName", "Settings", "MyText2")
End Sub

Featured Post

Hire Technology Freelancers with Gigs

Work with 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

609 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