Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

application.startuppath

Status
Not open for further replies.

sodakotahusker

Programmer
Mar 15, 2001
601
I have found samples of retrieving the directory that the application resides in the old app.path from vb6
but I cannot get that to work for me. I found a namespace in one of the threads but I don't find that namespace - aparently because I am creating a service and not a forms project??? Is there a way for me to determine the app path without using the application class?
 
This might be simple...

Application.StartupPath & "\imagepath.txt"

There are no imports or any other thing required to run the above line...

What is not always obvious when you are developing is just where application.startuppath is...

Generally speaking it is in the \bin directory of your project.

I always find

msgbox (Application.StartupPath)
to be a reliable method of finding out what the value is..

HTH


Rob
 
Create a windows service project and try your msgbox - no go - cause there is no application object there.
 
hahah...OK.. good point...

SOrry write the location to at textfile and read the textfile, or save the file there and then do a search for it.


:)


Rob


 
I'll just store the value in the registry and read it out of there. Thanks.
 
Wait a second. That returned the windows\system32 directory. That is not where my windows service is running from ?
 
Are you sure? probabaly though a service host....


As per earlier...
<snip>
What is not always obvious when you are developing is just where application.startuppath is...
</snip>
but do a replace on "when you are developing" for ""

:)


Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top