[program-l] Re: form and objects visual c#

  • From: Darko Milosevic <daremc86@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Mon, 25 May 2015 12:43:12 +0200

Yes, it's possible, and all needs to be visible immediately, but, try to give
the admin privileges to your applications by adding a manifest file.
Better way is to create the configuration file, and to use Properties.Settings
to get or set settings.

----- Original Message -----
From: Juan Hernandez
To: program-l@xxxxxxxxxxxxx
Sent: Monday, May 25, 2015 6:46 AM
Subject: [program-l] form and objects visual c#


Hi All,



I am really tired, and that's probably why I'm missing something so obvious.



I have form1, and form2.



I have a Settings class that stores all my settings while the application is
running. The settings object on initialization access a xml file with all of
the settings my application needs to run.



Now, if I initialize this object in form1, Settings appSettings = new
Settings();



All is good. I can get all of my settings.



Now, we have form2. I know if I just initialize the settings object in
form2, it'll just get a clean settings pull from the xml file. I instead just
want to access one settings object application wide.



Because if I change fields in form1's settings object, when I access form2,
the things I updated in form1, willnot be available to form2.



I could save everytime something is changed in settings to the xml file, but
this would involve a lot of disk access.



I have a timer that saves settings automaticly every 3 minutes. But If I
need a new setting for form2, it will not be there since it hasn't been three
minutes since I called form2.



I hope this isn't too confusing. I want to access a single object from
multiple forms. Is this possible?


Any help will be appreciated.


Other related posts: