VB.NET 2010 Convert String to System.Drawing.Color

Probably a simple one, but I'm not sure where to find it. Normally it's easy if the name of the string was called 'black', 'white', etc. But I'm using RGB values now, aka like FFFFFF = white 000000 = black to adjust things. Reason being is it will be configurable in a INI file so it is a string that has 'FFFFFF' for example.

How can I convert this to System.Drawing.Color, in for example, a .backcolor of a picturebox?
Who is Participating?
Swapnil PipariaConnect With a Mentor ArchitectCommented:
Hi Valleriani,

    You can do it by,
.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF")

Open in new window

VallerianiAuthor Commented:
Oh wow, I completely missed this one. THanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.