lindawqu
October 24th, 2005, 06:54 PM
how to get the application directory? in vb, it is app.path, but i don't know in c#. thanks
|
Click to See Complete Forum and Search --> : get application directory lindawqu October 24th, 2005, 06:54 PM how to get the application directory? in vb, it is app.path, but i don't know in c#. thanks darwen October 24th, 2005, 07:29 PM Try these : public class Example { static public string ApplicationPath { get { return System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); } } static public string EntryAssemblyPath { get { return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); } } } The first one will work for WinForms applications, the second for console-based applications. Darwen. Jason Isom October 24th, 2005, 07:31 PM Application.StartupPath codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |