Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

759 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

20 Experts available now in Live!

Get 1:1 Help Now