Solved

save settings

Posted on 2003-11-09
2
233 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now