Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VS2010 Ultimate - C# - Whats is the location of the file config.ini

Posted on 2012-12-26
3
Medium Priority
?
561 Views
Last Modified: 2013-01-09
Hello guys.

The code below creates the file config.ini with the values used by the User when the app is closed.
void Form1_FormClosing(object sender,FormClosingEventArgs e)
            {
            IniFile ini=new IniFile(Application.StartupPath+@"\\config.ini");

Open in new window

When running the app in VS2010 Ultimate, the file config.ini will be saved in the app directory\bin\Debug.
By publish, install and run the app, I can not find the file config.ini.
What is the location of the file config.ini?

Thanks in advanced,
ocaccy
0
Comment
Question by:ocaccy
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
lisfolks earned 2000 total points
ID: 38727306
The config.ini file will be in the same directory as the EXE file that was run. Let's say your app executable is called MyApp.exe. Let's say your install places it in C:\MyAppDir. When you run C:\MyAppDir\MyApp.exe, the config.ini file will be in that same directory: C:\MyAppDir\config.ini.

UNLESS, you're using ClickOnce to install. According to Microsoft's docs for Application.StartupPath:

This path will be different depending on whether the Windows Forms application is deployed using ClickOnce. ClickOnce applications are stored in a per-user application cache in the C:\Documents and Settings\username directory.
See here for more info:
Application.StartupPath Property (System.Windows.Forms)
0
 

Author Comment

by:ocaccy
ID: 38742643
Dear lisfolks,
Thank you.

Happy New Year.

We show the Documents ad Settings folder.
However as you can see below, it is a shortcut.
I could not access the file generated config.ini!

My app is already running perfectly, except that my User wants to access the file config.ini.

I need stores the value of a NumericUpDown field in a external file.
When the User clicks the close button, the value of the NumericUpDown automatically be saved in the external file xxxx.ini in the My Docucents folder.
When the app is called, automatically restoring the value in this file xxxx.ini for the NumericUpDown field.

Have any tips?

Thanks in advance,
ocaccy
Documents and Settings capture
0
 

Author Closing Comment

by:ocaccy
ID: 38758496
Thank you, this help me to solve the problem.

Best Regards,
ocaccy
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses

773 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