Solved

Store Value before Application.Restart()

Posted on 2010-08-16
6
630 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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