Solved

save settings

Posted on 2003-11-09
2
237 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
[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
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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