I am trying to save the background color of my main textbox so that if a user changes it, those changes will be automatically save and retreived when the user re-opens the application. The code builds fine, but throws and error, saying "specified cast is not valid". It appears that the registry only accepts string values, but attempting to convert to a string has the problem of getting it back to a color value. So far nothing I have tried has worked. . . . This is VB 2008 . . . .
Code:
Dim bColor As Color
Try
bColor = Me.RichTextBox1.BackColor
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\ASM\CanvasColor", "bColor", bColor)
bColor = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\ASM\CanvasColor", "bColor", Color.LightGray)
Me.RichTextBox1.BackColor = bColor
Catch ex As Exception
MsgBox(ex.Message & " $%#&*!!!!")
End Try
Comment