Solved

I can convert a string to color, but how do I convert a color to string (to store it in XML)

Posted on 2008-06-21
3
376 Views
Last Modified: 2010-05-18
Friends,

I am using an XML file to store user settings for my app.  This method has worked great until I tried to deal with colors.

Now, I know I can convert a String to a color.. xmlAltRowColor = Color.FromName(xmlReader.ReadString)

But how do I convert a Color to a string?

Syntax Help Requested.  

Thanks in advance!

Best Regards,
Eric
0
Comment
Question by:indy500fan
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 21838218
it is quiet easy, just use:

dim s as string
s = yourcolor.ToString()
0
 
LVL 14

Expert Comment

by:ptakja
ID: 21861409
Jaime_olivares has the correct answer.

In fact, you can convert almost any object into a string using the .ToString method. I believe that the .ToString method is part of the System.Object class which is the base class for everything in .NET.

I say "almost" because some user-created classes may not be coded to support the .ToString method. But all .NET Framework classes do.

For example, take an Integer value x which has a value of 5

Dim x As Integer = 5

x.ToString will return "5"
0
 

Author Comment

by:indy500fan
ID: 21861446
jaime_olivares,

I am so sorry, I forgot all about this.  I used your solution, but forgot to award points.

ptakja, yes I agree, and I implemented Jaime's solution, I just forgot to give Jaime points.

Regards,
Eric
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question