0

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");

When running the app in Visual Studio 2010 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

punter
  • 460
  • 1
  • 6
  • 22
user1635148
  • 49
  • 1
  • 3
  • 7

1 Answers1

1

The Application.StartupPath point to the location where the .exe of your application is located. Your .ini file should be there.

However, using .ini files is considered a bit outdated, a better approach (and built-in in .net) is using application configuration files (app.config for WinForms)

Community
  • 1
  • 1
SWeko
  • 30,434
  • 10
  • 71
  • 106
  • Thank you. I'm using the app.config for windows. Project/Properties/Settings.... Where is the file located? Sometimes, the user need to delete this data outside of the application and start from the beginning. We can do that? – user1635148 Dec 27 '12 at 08:31
  • When deployed, the config file is in the folder the .exe is in, and has the name .exe.config – SWeko Dec 27 '12 at 09:54
  • Thank you, I found this file but I can't reset the data out of the app. – user1635148 Jan 08 '13 at 23:17
  • Thank you. We solved the problem by redirecting the file to a location with easy access to the User.Like this: IniFile ini=new IniFile("F:\\Xconfig.ini"); – user1635148 Jan 10 '13 at 03:01