Save settings before form shuts down?

Jambo

Member
Joined
Apr 23, 2009
Messages
6
Programming Experience
Beginner
Hi,

I need to save some settings before closing the form (by default this happens after..) I have tried my.Settings.Save() but it didn't work (what's this method for then ?)

I hope this is doable because my entire idea relies on it, so if anyone has a way to do it I would love to hear it.

Jambo
 
First up, please post in the most appropriate forum for the topic of your thread, not the first one you come to. Moved.

As for the question, My.Settings.Save DOES work, so if what you want to happen is not happening then it's because you're doing something wrong. As you haven't actually told us what you're trying to achieve and what the problem is, we can't really provide a solution. WHY do you feel you need to save the settings before the form closes?
 
First up, please post in the most appropriate forum for the topic of your thread, not the first one you come to. Moved.

Yes, sorry.

As for the question, My.Settings.Save DOES work, so if what you want to happen is not happening then it's because you're doing something wrong. As you haven't actually told us what you're trying to achieve and what the problem is, we can't really provide a solution. WHY do you feel you need to save the settings before the form closes?

Here is my test:
I create an application ( a Windows form ) and a setting parameter.
I change the parameter's value at runtime.
I copy my application elsewhere ( by code, we're still at runtime )
Now, when I launch the newly created application I want it to have the modified setting value but it's not, it's having the default one even though I called Setting.Save before creating the second form, why is that ?
 
Basically what I am trying to do is dynamically compile code after someone's input, meaning that the application must have values like it was originally designed specifically for him.
I have tried codedom and I almost got it to work except for the little fact that the output assembly now comes out with the console too.( and some other small things )

I thought the settings idea could save me.
 
Your second application is starting with default settings. Best you could do is when launching the "second" copy pass the settings as command line arguments and then use them to set your settings in that copy.
 
.NET apps have two config files: the application config file, stored in the program folder, and the user config file, stored separately under each user's Documents & Settings folder. The application config file contains Application-scoped settings and the default values for User-scoped settings, while the user config files store the current values of User-scoped settings for each user. If you create a new copy of an application you aren't copying the current user values. You're only copying the default values so that's what you get when you run the new app.

This is a prime example of why you need to provide a FULL and CLEAR description of what you're doing, why you're doing it and what exactly goes wrong. When you don't provide all the information you give us an incomplete and, therefore, most likely incorrect view of what's happening.
 
hey I thnik I can achieve that using registry instead of settings.
As for Sprint I'm not sure what you exactly mean as I'm quite new to VB, can you please elaborate?
 
Thanks for the explanation jmcilhinney. I have some ideas let me try them first, if I fail I'll get back to you with a clearer description.
 
Back
Top