Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1181
  • Last Modified:

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?
0
Valleriani
Asked:
Valleriani
1 Solution
 
Swapnil PipariaCommented:
Hi Valleriani,

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

Open in new window

Thanks,
netswap
0
 
VallerianiAuthor Commented:
Oh wow, I completely missed this one. THanks!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now