Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitlePersist text in the Registry
Keywordsregistry, text, save, restore
CategoriesTips and Tricks
 
In the Form_Load event handler, load the saved text into a TextBox using GetSetting.

In the Form_Unload event handler, save the text using SaveSetting.

 
' Load the saved value from the registry.
Private Sub Form_Load()
    txtPersisted.Text = GetSetting(APP_NAME, SECTION_NAME, _
        "txtPersisted", "")
End Sub

' Save the value in the registry.
Private Sub Form_Unload(Cancel As Integer)
    SaveSetting APP_NAME, SECTION_NAME, "txtPersisted", _
        txtPersisted.Text
End Sub
 
This method saves the text in the key HKEY_CURRENT_USER\Software\VB and VBA Program Settings\PersistText\SavedValues.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated