I am trying to save and retrieve a color from the registry so that when the user selects a textbox color, the same color will appear when the user starts the program
The code I used to write the registry is shown below.
How do I retrieve the color back from the registry and assign it to the Textbox?
The code I have listed below gets an error:
Value of type 'String' cannot be converted to 'System.Drawing.Color'.
This is the same type of error I had with an earlier post:
Can anyone tell me the correct code, so I can retrieve the color name?
Your help would be greatly appreciated.
'Code to write to registry
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Knightlite\Signal 102 V5\Registration\CanvasColor", "Canvas", ColorDialog1.Color)
'To retrieve color, I use:
Dim CanvasColor As String = CStr(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Knightlite\Signal 102 V5\Registration\CanvasName", "Canvas", String.Empty))
txt1.BackColor = CanvasColor