|
|
Title | Persist text in the Registry |
Keywords | registry, text, save, restore |
Categories | Tips 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.
|
|
|
|
|
|