Solved

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

Posted on 2012-12-26
3
516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

738 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