How to save a class in the settings.settings

Discussion in 'C#' started by morfix78, Oct 25, 2007.

  1. morfix78

    morfix78 New Member

    Joined:
    Sep 16, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    hello,
    i have created a class with variables and i would like to know if it is possible to save the class in the settings file so that when the user will run the application i will be able to load the values from the setting.
    i created a object in the settings file from the type of the class and i tried to write:
    " Properties.Settings.Default.Model = this; //the model is the class
    Properties.Settings.Default.Save();"
    but when i run the application again the values are not the same as i wanted.
    how can i save the values and load them when i run the application again.
    thanks
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You need to look at the serialization concept.
     
  3. morfix78

    morfix78 New Member

    Joined:
    Sep 16, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    can you please give me more details?
    thanks
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice