-
Hey Guys!
I'm in a big problem ! I'm making a prog. that takes some
information from the user and generates a web page for
him.It lets the user to select the BG ,TXT, LINK etc. color
by a Common Dialog Color box.But the problem occurs when
i'm trying to convert the LONG color code into HEX color
code.It happens that the VB Hex color code value and the
HTML Color code HEX value dosen't match.So if anyone solve
the problem,i'll be glad ! Thanks
e-mail me at : [email protected]
-
Hey, I got some code here from the forum (can't remember who posted it, sorry :()
Code:
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
Will make the long RGB value to a html HexColor!
-
Doh, you beat me to it. hehe. Well, I just figured it out but as Jop, just pointed out with the code the basic difference appears to be the order of the hex values for VB vs HTML. i.e.
HTML #HexValue1HexValue2HexValue3
VB &H00HexValue3HexValue2HexValue1&
So to go from VB to HTLM you would strip off the leading "&H00", strip off the trailing "&", reverse the remainging three hex values and slap a "#" in front of them.
Hope that helps,
KillemAll
-
Thanks 2 Jop & KillemAll
Thank you two very musch !
I want to be friend with you two,if you want
please mail me at [email protected]
Bye ! Bye !