I have implemented a function to set some default settings for my application. Usually I call in form_load
However, I'm using also Properties.settings to save some customized setttings and if I click on save button, All my settings are being stored/saved in which I can load later when I press a nother button to load my settings.
My question. How it is possible to check if I have some stored/saved settings when I run my applicaton. So instead of having two buttons one for saving the settings and one for displaying the saved settings, I need simply my customized settings to be displayed when I run my application next time.
So. I implemented two functions:
FillDefault();
LoadCustomSetings();
in a form load, how it is possible to check if I have some saved settings so that my application will run the LoadCustomSettings(); and if there was no saved settings then my applicaiton will run FillDefault();
this is needed especially if I need to send this application to some other user, so he can see the default settings first time, and if he saved some custom settings the applicaiton will run the new settings next time by calling LoadCustomSettings();
Rano AHPosted Sep 24, 2013, 2:44 AM
Thank you so much for the help.
I tried to implement the code as you mentioned, but it keeps giving me some errors like (this class has been turned to obsolete), also, I'm trying to understand the code, but really I cannot. I'm still beginner in coding, and this is first time I've ever used :Properties.Settings
I'm afraid that I misunderstood the usage of using properties.Settings.
can you reply me on this:
In my application, I'm trying to save some default settings related to my application, like what comboBoxes in my application must populate when my application runs second time if I pressed saving data button.
What I understood that using properties.settings will save my data on user.config (xml file) which can be found under application Data >> Local>>,,, and this is why only one user can see the saved settings.
because of this, I implemented two methods (one to load default settings first time the user runs the application) and (second method to load the saved settings, only if the user clicked on Saved Data Button).
So how can I do that, especially if I need to send my application to another user so that my application will load the default settings first time and if user changed the settings my application will show the saved settings next time the user runs the application.
You have answered my question already I guess, but I just wanted to make sure that you provided the solution based on my requirements. (As I told you, I couldn't understand the code that you implemented :-( and that's why I wanted to recheck and if there is a simpler solution rather than this. Or maybe I just need more help on the code that you provided.
Iftikar HussainPosted Sep 19, 2013, 7:42 AM
string isDefault=ConfigurationManager.AppSettings["IsDefault"];
depend on the value you do your logic.
and update the value like below
Regards,
Iftikar
Rano AHPosted Sep 19, 2013, 7:33 AM
I've done that, but what to add in form_load to set as condition to check either there is saved setings or no.
Iftikar HussainPosted Sep 19, 2013, 6:00 AM
http://msdn.microsoft.com/en-us/library/ms184658(v=vs.90).aspx
and in that config add one app setting key
Regards,
Iftikar
Rano AHPosted Sep 19, 2013, 5:46 AM
Iftikar HussainPosted Sep 19, 2013, 4:54 AM
Regards,
Iftikar
Rano AHPosted Sep 19, 2013, 4:29 AM
I'm afraid that I didn't get it. Would you please explain more how to do it or provide me with a sample implementation?
Iftikar HussainPosted Sep 19, 2013, 4:06 AM
You can have config setting in app.config to check weather to load default setting or not.
Regards,
Iftikar