VB.NET 2.0 & Application Settings..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • modi321@gmail.com

    #1

    VB.NET 2.0 & Application Settings..

    Everyone,

    I have a question on how to use persistant application settings with
    2.0. I understand I can use defined types like ints, strings, and so
    on, but how about my own custom class? The problem is I can fill in
    the 'type' of the setting as my custom class, but if I try to save the
    settings - calling the My.Settings.Sav e() - then reload the settings at
    a later time with the My.Settings.Rel oad() - the data in my custom
    class is not there. Infact I checked the XML and it only has the
    setting's name.

    In short:
    1. Can I use my own class as a setting variable?
    1.b. If so, how?
    2. Do I need to use the Type converter?

    http://msdn2.microsoft.com/en-us/library/a65txexh.aspx
    "Applicatio n settings can be stored as any data type that is XML
    serializable or has a TypeConverter that implements
    ToString/FromString. The most common types are String, Integer, and
    Boolean, but you can also store values as Color, Object, or as a
    connection string."

    3. Is there a size restriction on the value of an application setting?
    I wonder if my class exceeds this.

    Thank you in advance,

    Modi

  • Herfried K. Wagner [MVP]

    #2
    Re: VB.NET 2.0 & Application Settings..

    <modi321@gmail. com> schrieb:[color=blue]
    > I have a question on how to use persistant application settings with
    > 2.0. I understand I can use defined types like ints, strings, and so
    > on, but how about my own custom class? The problem is I can fill in
    > the 'type' of the setting as my custom class, but if I try to save the
    > settings - calling the My.Settings.Sav e() - then reload the settings at
    > a later time with the My.Settings.Rel oad() - the data in my custom
    > class is not there. Infact I checked the XML and it only has the
    > setting's name.[/color]

    Are you sure the settings are under the user scope and not the application
    scope? Note that settings with application scope are not saved by calling
    the 'Save' method.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    Working...