Converting Text to Default Colors in VB.NET

From: Terry (Terry_at_discussions.microsoft.com)
Date: 09/30/04


Date: Thu, 30 Sep 2004 11:35:09 -0700

I have an XML file that has settings for my app. Many of the settings
involve color (i.e. <BackColor>Red</BackColor>). The XML value is read into
a string, so I have a string called strBackColor with the value "Red". Now I
want to set the form to BackColor.Red. How do I do this without having a
giant SELECT like this...

SELECT CASE strBackColor
CASE "Red"
Me.BackColor = Backcolor.Red
CASE "Blue"
Me.BackColor = Backcolor.Red
...
END SELECT

Acually, I want it to be part of a global shared method that I can use
throughout my system, where I pass in a String and it returns the color..like

Me.BackColor = CStringToColor(strBackColor)

Thanks for your help,
Terry



Relevant Pages

  • Re: how to write to an xml file
    ... Create an object representation of the xml file and fill it with data: ... string Value; ... string ReportName; ... Settings settingsObject=new Settings; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Remember Previous Settings for an Application
    ... write to an XML file from VB.net? ... My.SEttigns and the settings designer. ... Dim setting1 As String = doc....Value ...
    (microsoft.public.dotnet.languages.vb)
  • Simple XML question
    ... I have an XML file formated as this ... settings group I want to read in a settings read function and return it... ... how would i specify that i want the database ... Public Shared Function ReadSetting(ByVal settingName As String) As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Deployment + Vista
    ... The problem is it's connection string is always hard ... Server settings form. ... guess it's a good thing I do not use that for settings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Calculations on activex components using IUSR
    ... After doing the calculations on my values the value is converted to string ... When converting the value to string it contains a comma instead of period. ... and doesn't change its locale settings ...
    (microsoft.public.vb.com)