Home All Groups Group Topic Archive Search About

How can I know my application's path?

Author
8 Apr 2006 6:50 AM
Moosdau
Hello everyone:

  for example, if my application is in "c:\" , I want the app could
know that and tell me , then I close it and move it to "d:\" , when I
run it again, it could know where it is now.

How can I get this infomation?
Thanks so much!

Author
8 Apr 2006 7:09 AM
s
In VB6 you would simply reference App.Path; in VB.Net I'm guessing the App
object still exists - look in the VB Compatibility namespace...

Chris


Show quoteHide quote
"Moosdau" <moos***@gmail.com> wrote in message
news:1144479006.566237.118610@v46g2000cwv.googlegroups.com...
> Hello everyone:
>
>  for example, if my application is in "c:\" , I want the app could
> know that and tell me , then I close it and move it to "d:\" , when I
> run it again, it could know where it is now.
>
> How can I get this infomation?
> Thanks so much!
>
Author
8 Apr 2006 7:14 AM
Cor Ligthert [MVP]
Hi Moosdau,

We did not see him a long time. It was a while almost daily asked.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.startuppath(VS.80).aspx

I hope this helps,

Cor

Show quoteHide quote
"Moosdau" <moos***@gmail.com> schreef in bericht
news:1144479006.566237.118610@v46g2000cwv.googlegroups.com...
> Hello everyone:
>
>  for example, if my application is in "c:\" , I want the app could
> know that and tell me , then I close it and move it to "d:\" , when I
> run it again, it could know where it is now.
>
> How can I get this infomation?
> Thanks so much!
>
Author
8 Apr 2006 7:27 AM
Moosdau
Thanks very much for your help (and so quickly..)!!!

I've tried to search for hours , but I still can't find it.

system.windows.forms
I will remember this namespace -- ^_^

Thanks again!!
Author
8 Apr 2006 10:23 PM
tommaso.gastaldi
Public G_ApplicationDirectory As String =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)


Moosdau ha scritto:

Show quoteHide quote
> Thanks very much for your help (and so quickly..)!!!
>
> I've tried to search for hours , but I still can't find it.
>
> system.windows.forms
> I will remember this namespace -- ^_^
>
> Thanks again!!
Author
8 Apr 2006 10:43 PM
Herfried K. Wagner [MVP]
"Moosdau" <moos***@gmail.com> schrieb:
>  for example, if my application is in "c:\" , I want the app could
> know that and tell me , then I close it and move it to "d:\" , when I
> run it again, it could know where it is now.

Check out the code snippet at
<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPath>.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>