Solved

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

Posted on 2012-12-26
3
484 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

943 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

6 Experts available now in Live!

Get 1:1 Help Now