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
369 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
Comment Utility
it is quiet easy, just use:

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

Expert Comment

by:ptakja
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now