×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Converting VB colors to web-friendly HEX code

Converting VB colors to web-friendly HEX code

Converting VB colors to web-friendly HEX code

(OP)
I've searched and searched today and I've seen a LOT of examples on how to convert HEX to VB RGB, but I'm not finding any advise on the reverse. Wondering if it's even possible

Here's what I'm trying to do: I have a form with a label and a commondialog control for selecting/changing the backcolor on the label. I'm wanting to take that chosen backcolor, which comes out as a decimal value, and convert that to a HTML HEX color value.

So, for the color VBGreen, I get this:
VB COLOR VALUE: 65280
AFTER CONVERSION USING THE HEX COMMAND: FF00 ' ( EXA: THISCOLOR= HEX(MYVBCOLOR) )

Now, that's NOT a valid HTML color value. If plugged that into a webpage, it would be pure RED, not green.

Any suggestions?

------------------------------------
yinyang Over 30 years of programming, and still learning every day! yinyang

RE: Converting VB colors to web-friendly HEX code

It's a quirk of HTML - when specifying colours in Hex it requires all three RGB bytes, even if they are 0.

So FF00 actually needs to be 00FF00

RE: Converting VB colors to web-friendly HEX code

Did the above help?

RE: Converting VB colors to web-friendly HEX code

(OP)
It helps if the user chooses a primary color, but when dealing with 16 million possibilities, it get's a little but into a gray area there.

Appreciate the suggestion though :)

------------------------------------
yinyang Over 30 years of programming, and still learning every day! yinyang

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close