Is there a way to use the color picker that comes with the microsoft common dialog control to get html color codes? Or something else that I could look at so a user could click on a color and get a html color code from it?
Thanks in advanced.
Printable View
Is there a way to use the color picker that comes with the microsoft common dialog control to get html color codes? Or something else that I could look at so a user could click on a color and get a html color code from it?
Thanks in advanced.
you need to convert the number to hex code
like black RGB(0,0,0) is 000000 and white RGB{255,255,255) is FFFFFF
------------------
DiGiTaIErRoR
Be careful that HTML uses RGB convention (Red, Green, Blue) but VB uses BGR (Blue, Green, Red)
Here's a function you can try:
Public Function RGBHexColor(lngColor As Long) As String
Dim sHex As String
sHex = Hex(lngColor)
sHex = Right$("000000" & sHex, 6)
sHex = Right$(sHex, 2) & Mid$(sHex, 3, 2) & Left$(sHex, 2)
RGBHexColor = sHex
End Function
Just call this function and pass the color the CommonDialog returns.
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
Hi Ryan,
I made a program to help me with hex colours. You can download it here:
http://members.xoom.com/rino_2/HexColour.zip
I hope you like it.
------------------