Solved

save settings

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

example

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

thx
0
Comment
Question by:camerononastick
  • 2
2 Comments
 
LVL 28

Accepted Solution

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

http://www.freevbcode.com/ShowCode.Asp?ID=1531

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
0
 
LVL 28

Expert Comment

by:vinnyd79
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
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 37
Excel VBA, find a string in a column, update a cell 7 81
Add a task in Outlook from access 11 40
Automatic Email Reminder 4 39
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 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