CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2001
    Location
    Czech Republic
    Posts
    78

    Reference types in application settings

    Hi, I am using .NET 4 and I have some troubles with application settings. Using simple value types (int, string, Point, Size etc.) and their default values is OK, but when I add a reference type to the settings (say an object of type System.Drawing.Printing.PageSettings), how do I specify the default value? One solution would be to add a new (perhaps static) class Settings which would call ApplicationSettingsBase.Reload() method, then check whether any of the reference types is null and initialize it properly. Is there any other preferred solution?

    Also many of the articles/howtos/faqs about application settings in .NET mention the possibility to bind them to properties of controls in WinForms. Is the whole concept of app settings really that focused on the property bindings or is it usable also for general settings that do not have their counterpart in any control?

  2. #2

    Re: Reference types in application settings

    If you ask me those application settings that they give you are pretty darn worthless. Ypu are far better off to just make your own settings class and implement IXMLSerilizable, then you can have whatever you want being saved.
    --------------------------------------------------------------------------------------------------------------------------
    Disclaimer - Most likely any code I have posted as an answer was most likely written free hand and may have some minor compile errors, and is merely intended to give you the idea.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured