473,757 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to find current application path using c#

(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the input box in c# program.
--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RUC Xsv7MxKlngw==</Id>
Nov 16 '05 #1
5 61941
Hi Sathya:
"sathya moorthy via .NET 247" <an*******@dotn et247.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the
input box in c# program.

--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RUC Xsv7MxKlngw==</Id>


You can use GetExecutingAss embly
http://msdn.microsoft.com/library/de...emblyTopic.asp
..FullName
to get the name and path of the assembly, then you can use the Path Class to
get the path.

HTH,

Bill
Nov 16 '05 #2
current running program? as in thee executable? If so to get the directory
you'd use Application.Sta rtupPath. To get the executable path you'd use
Application.Exe cutablePath.

On 16/04/2004 sathya moorthy via .NET 247 <an*******@dotn et247.com> wrote:
(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the input box
in c# program.

--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RU CXsv7MxKlngw==</Id>

Nov 16 '05 #3
Try to use Application.Exe cutePath, or SetUpPath
good luck!

"sathya moorthy via .NET 247" <an*******@dotn et247.com> wrote in message
news:#5******** ******@TK2MSFTN GP12.phx.gbl...
(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the
input box in c# program.

--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RUC Xsv7MxKlngw==</Id>

Nov 16 '05 #4
Try this, it worked for me...

string AppPath = System.Windows. Forms.Applicati on.StartupPath;
sathya moorthy via .NET 247 wrote:
(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the input box in c# program.
--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RUC Xsv7MxKlngw==</Id>

Nov 16 '05 #5
try this:

String currentProgram = System.Environm ent.CommandLine ;

that would give u the fullpath of your current executable.

hope that helps,

Du

"sathya moorthy via .NET 247" <an*******@dotn et247.com> wrote in message
news:#5******** ******@TK2MSFTN GP12.phx.gbl...
(Type your message here)
hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the
input box in c# program.

--------------------------------
From: sathya moorthy

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8EueDee9RUC Xsv7MxKlngw==</Id>

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
53487
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then Directory.CreateDirectory(dirName) Label1.Text = "Directory created" Else
0
1391
by: DJK | last post by:
I have a VB.NET Web Forms Application that used to work on Windows Server 2000. After an upgrade to 2003 the application fails with a Could not find a part of the path error message when setting the current directory using SetCurrentDirectory. Can anyone confirm what permissions are required on files and folders, to what level up the directory tree, for what account or provide any other useful information to resolve this issue. Many...
4
19847
by: Asbjørn Ulsberg | last post by:
I just wonder if it's a simpler way to get the path to the current user's temporary folder than this: string path = Path.GetFullPath(Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData), "..\\Temp")); It works, but is quite cumbersome. I also find it strange that Path.Combine() doesn't fix the '..\' part, so I need to use Path.GetFullPath() to have the '..\' resolved (it walks down one directory from...
3
2028
by: COHENMARVIN | last post by:
I put the following code in my asp.net page: dbPath = MapPath("/FBDB/db1_newport2003.mdb") strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" strConnect = strConnect & "Data Source=" & dbpath & ";" objConnect = new OleDbConnection(strConnect) ============================= but I get the following error: <b>* Error while updating original data</b>.<br
9
13751
by: Clinton Frankland | last post by:
Hi, On a Windows 2000 Server when attempting to use System.IO.Directory.CreateDirectory(string.concat(Server.MapPath(""), "\verify")) I receive a System.IO.DirectoryNotFoundException error: Could not find a part of the path "D:\". The full path is "D:\hshome\clinton\test.gotchasoft.com\verify" The web is running using impersonation as a user on the local machine.
1
3537
by: TRI_CODER | last post by:
I am trying to solve the following exception. The exception occurs when my ASP.NET code behind code attemtps to access a remore site using SSL. Please note that all certificates are valid and the remote site is trusted. Also, my web site uses a custom HTTPModule implemented in a DLL named Security.dll. Unable to find an entry point named EnumerateSecurityPackagesW in DLL security.dll. Description: An unhandled exception occurred during...
1
3616
by: Simon | last post by:
Dear Access friends, How can I load a string with his own folder address. The following code addressed to the system folder of MS programs.
1
1376
by: mathieu | last post by:
Hi, This is slightly off-topic (not purely C++). But I was wondering how do people handle ressources (input file) in their C++ applications in a cross platform way ? I tought first of using relative path from the current running executable, but I could not find a portable way of doing other than getcwd/_getcwd + argv which may or may not always work. My current implementation is to produce a C++ file that gets
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.