This is a simple way of finding the html color code for any color, this can be very usefull to find a colours code quickly and efficently

First create a standard form and place the following objects on it;

a textbox named; text1
a button named; command1
and a common dialog control called 'colordlg'

Finally, put the following code in the command1_Click event

Private Sub Command1_Click()

Dim Col As String, SootyR As String, SootyG As String, SootyB As String
Col = Hex(colordlg.Color)

Do Until Len(Col) = 6
Col = 0 & Col
SootyR = Mid(Col, 1, 2)
SootyG = Mid(Col, 3, 2)
SootyB = Mid(Col, 5, 2)
Text1.Text = Chr(34) & "#" & SootyB & SootyG & SootyR & Chr(34)
End Sub

You might also like...


Colin Harman MACITP I am 26 and live in sydney, australia. I enjoy drinking and going out, but I also enjoy writing programs + creating websites in my free time. I play golf and ski. One of my main intrests whe...


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard