Solved

Store Value before Application.Restart()

Posted on 2010-08-16
6
628 Views
Last Modified: 2013-12-17
Hi,

I need to restart my application without losing some values the user had set before.
For some reasons I can't write a config file or use the registry.

So maybe one way would be to add the needed parameter to the command line but I don't like this way and have not checked this out.
Maybe it's possible to use an embbeded resX for and just changing the values and after the restart the app can get the changed values?

If this is possible how can I change values and read them from an embedded resX?
Other solutions are welcome ...

Thanks

Andre
0
Comment
Question by:andre72
  • 4
6 Comments
 

Accepted Solution

by:
njgroup earned 333 total points
ID: 33444474
hmmm, I did this before in my application, but I was using xml file to store the configuration that has been set by the user, for he example, user A of the software is a french man, so went to settings tab, and has changed the language from english to french, internally, I change the value of language parameter for user A  in my xml file to french, so next time if user A access the software he will find it french not english anymore
0
 

Expert Comment

by:njgroup
ID: 33444487
so why dont you use xml parsing for storing user settings and defaults?
it's really powerful....
0
 

Author Comment

by:andre72
ID: 33444552
The reason for is that there's just temporary use for a fistfull of parameters.
E.g. the app should do an update check at the next restart but than no more when it will be startet.
In worst case if there's no other way for I think there'll be no other way than using a xml file but if it willl be possible in any way I prefer to don't use that.

The reason for is that we got some problems with Windows 7 user settings some time before where the application don't work anymore as the user had no write access to the xml file ...
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 14

Assisted Solution

by:systan
systan earned 167 total points
ID: 33445297
0
 

Assisted Solution

by:njgroup
njgroup earned 333 total points
ID: 33448310
>>The reason for is that we got some problems with Windows 7 user settings  some time before where the application don't work anymore as the user  had no write access to the xml file ...


that why there is in windows 7 something called "Run as administrator", or when you create file, you need to give it permissions of the user logged in already, if the user is limited and does not have rights to writes in your application folders, then not only xml will not work, but also write to any file is not gonna be,
anyway, my softwares was working perfectly in windows xp, however, about 2 month ago, I had new reqiurments that it should work under windows 7, I was having these issues like in windows xp the user folder is documents and settings in windows 7 its c:/ user/
and the permissions issue..... but all solve easily

I advice u to give it a try and I am sure you will use it everywhere:

here is samples:
http://www.c-sharpcorner.com/uploadfile/shehperu/simplexmlparser11292005004801am/simplexmlparser.aspx

http://www.codeproject.com/KB/cpp/parsefilecode.aspx
0
 

Expert Comment

by:njgroup
ID: 33448401
by the way, I advice you to use xml rather than text file, because its really pretty organized, hierarchy enabled (you can use features of root and children), really more faster in rendering than the text file, markup language enabled, attributes, and so on,.....
see http://en.wikipedia.org/wiki/XML
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now