user2895707 user2895707 - 4 months ago 14
Vb.net Question

Convert a String to a System.Color in .NET

Good day, I'm trying to make this application on VB.NET in which the user can change the background color of the application, when the application closes the color should save to a XML. The saving was piece of cake but now the real dilemma is how to convert the String

"Color[white]"
to a
System.Color
.

I already Googled my problem but no result. Plus I'm already familiar to
Color.FromName
.

Thanks in advanced.

Answer
Dim C = System.Drawing.Color.FromName(YourColorString.Replace("Color[" , "").Replace("]", ""))