Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

Custom Application Settings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rob - 23 Jun 2006 17:50 GMT
Using the settings editor I am trying to add a setting whose type is a
custom type. In a first approach I tried a class marked as
[Serializable]. But then when I try to get the property the way shown
bellow I get null returned.

MyProperties prop = Properties.Settings.Default.MyProp

Assuming prop is null because MyProperties is not a value type I
changed MyProperties from a class to a struct. Unfortunately, settings
editor does not allow me to add a struct giving me the following error:

"There was an error generating the xml document"

Can a value type not be serialized or what is going on here?

In any case, how can I add custom types to the application settings?

Thanks
rob - 23 Jun 2006 18:13 GMT
It seems that for the class case the return value is null because
nothing has been stored yet and therefore the type cannot be
deserialized. That poses the question why not just a new object is
created with the default constructor instead of returning null? Also
how do I get the struct case working?

Thanks

> Using the settings editor I am trying to add a setting whose type is a
> custom type. In a first approach I tried a class marked as
[quoted text clipped - 14 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.