How to write and read a Color in VB.NET
Learn how to read and write Color values in VB.NET, including converting colors to and from hexadecimal representations.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: How to write and read a Color in VB.NET

Epic FaileditedPosted Jul 3, 2010, 10:44 PM EDTEdited Jul 3, 2010, 10:45 PM EDT
Public Function HexToColor(ByVal strHex As String) As Color Return Color.FromArgb(Convert.ToUInt32(strHex, 16)) End Function Public Function ColorToHex(ByVal cColor As Color) As String Return Hex(cColor.ToArgb) End Function Public Function ColorToHex(ByVal R As Byte, ByVal G As Byte, ByVal B As Byte) As String Return Hex(CUInt((R << 16) + (G << 8) + B)) End Function