Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

821 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