I was trying to find a way to store a color object in a database field. I tried to find away to get the color as RGB values, but I see 'getARGB()' but no
'setARGB()'
How can I do this?
Justin Fox
Printable View
I was trying to find a way to store a color object in a database field. I tried to find away to get the color as RGB values, but I see 'getARGB()' but no
'setARGB()'
How can I do this?
Justin Fox
You could store the RGB value as a delimited string like "255,255,255". When you pull it out, split it and then use int16.parse()
I would store it as an integer in the database.
Color structures have a .ToArgb method that produce an integer representation of the AARRGGBB values of the color. Store that value, and you can recall it into a color structure using Color.FromArgb(integer)
Code:Dim myColor As Color = Color.Red
Dim myARGBValue As Integer = myColor.ToArgb
Dim myOtherColor As Color = Color.FromArgb(myARGBValue)
Cool Thanks!
Justin Fox