Converting colors

kejpa

Junior Contributor
Joined
Oct 10, 2003
Messages
320
Hi,
How do I save my favorite color to the Registry and then use it for the color of a textbox?!?

I tried
Code:
oRegKey.SetValue("FavoriteBackColor", txtFavorite.BackColor.ToArgb, RegistryValueKind.DWord)

txtFavorite.BackColor = CType(oRegKey.GetValue("FavoriteBackColor"), Color)
but it doesn't work. "Integer can't be converted to Color" I'm told....

TIA
/Kejpa
 
you could convert the color to the ARGB values and save those in the registry and convert it back to a color using color.fromargb
 
Thanx PD,
Code:
txtFavorite.BackColor = Color.FromARGB(cInt(oRegKey.GetValue("FavoriteBackColor")))
Made the trick

/Kejpa
 
Back
Top