Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 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