Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert a decimal color to hex

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm a newbie and I have a problem. It's probably so simple but I can't get it. Not with the MSDN help anyway.

I have a form with a command button called cmdChooseColour, a text box called txtcolor, a common dialog box called cdbOpenSave, and the following code.

Private Sub cmdChooseColour_Click()
With Me.cdbOpenSave
.CancelError = True
.Flags = &H2&
.ShowColor
End With
Me.BackColor = cdbOpenSave.Color
txtColor = cdbOpenSave.Color
End Sub

How can I get the number into the text box so it displays as a RGB Hex number.
Max
 
Hey Pal,
It's very Simple. Use the Hex coonversion function which will return a Hexadecimal equivalent of it.
Instead of writing...
txtColor = cdbOpenSave.Color

try this...
txtColor = Hex(cdbOpenSave.Color)
It should work properly.

All the Best.
Atul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top