[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

save settings

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
camerononastick
Asked:
camerononastick
  • 2
1 Solution
 
vinnyd79Commented:
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
 
vinnyd79Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now