|
-
Nov 15th, 2001, 03:50 PM
#1
Thread Starter
Hyperactive Member
app.path equivalent
does anyone know how to return the application path, like app.path in vb6?
-
Nov 16th, 2001, 11:40 AM
#2
Thread Starter
Hyperactive Member
-
Nov 17th, 2001, 12:53 PM
#3
Application.ExecutablePath gives the path including the EXE name.
Application.StartupPath gives the path to the Dir :-)
-
Nov 19th, 2001, 03:54 AM
#4
Originally posted by zchoyt
Application.ExecutablePath gives the path including the EXE name.
Application.StartupPath gives the path to the Dir :-)
...and in what manner does this differs to my response?
-
Nov 19th, 2001, 02:41 PM
#5
Chill out!!
I just read it quickly.
I was just trying ro be helpful
-
Nov 20th, 2001, 04:07 AM
#6
Originally posted by zchoyt
Chill out!!
I just read it quickly.
I was just trying ro be helpful
Oh I'm very relaxed 
I was just confused about your answer since it was exactly what I already posted.
I was simply wondering if my reply was unclear in some way.
-
Nov 20th, 2001, 01:35 PM
#7
np
-
Jun 21st, 2002, 09:21 PM
#8
Addicted Member
The proper replacement for app.path in VB.NET is System.Reflection.Assembly.GetExecutingAssembly.Location()
(This will return the File Name of your exe at the end)
Code:
Dim sPath As String
sPath = System.Reflection.Assembly.GetExecutingAssembly.Location()
I use this to find the folder:
Code:
Dim oPath As System.IO.Path
Dim sPath As String
sPath = System.Reflection.Assembly.GetExecutingAssembly.Location()
sPath = oPath.GetDirectoryName(sPath)
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Jun 21st, 2002, 11:40 PM
#9
Well that' great and all, but I am using asp, not asp.net
-
Jun 22nd, 2002, 12:05 AM
#10
Originally posted by zchoyt
Well that' great and all, but I am using asp, not asp.net
What does that have to do with anything?
Originally posted by Dmyze
The proper replacement for app.path in VB.NET is System.Reflection.Assembly.GetExecutingAssembly.Location()
(This will return the File Name of your exe at the end)
What makes that the "proper" replacement for app.path? Especially if it includes the EXE name and app.path omits it? I would venture to say that Application.StartupPath does the exact same thing as app.path did, and is therefore far more "proper" than what you gave.
-
Jun 22nd, 2002, 12:52 PM
#11
Addicted Member
http://msdn.microsoft.com/library/de...albasicnet.asp
"The App object in Visual Basic 6.0 was a global object used to set or retrieve information about the application. There is no direct equivalent for the App object in Visual Basic .NET; however, most of the properties can be mapped to equivalent properties in the .NET Framework."
"Path = System.Reflection.Assembly.GetExecutingAssembly.Location "
The Application.StartupPath is part of the System.windows.forms namespace. This is fine if you are writing a windows application in VB, however if you try to create a console application you won't have that name space available.
System.Windows.Forms.Application.StartupPath()
Last edited by Dmyze; Jun 22nd, 2002 at 01:04 PM.
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
-
Jun 23rd, 2002, 06:48 PM
#12
Originally posted by Dmyze
The Application.StartupPath is part of the System.windows.forms namespace. This is fine if you are writing a windows application in VB, however if you try to create a console application you won't have that name space available.
Not by default, but all you have to do is add a reference to it, and it is available. And you'll still be writting a normal console app. It's not too hard.
As for your quote, I would agree that it (that reflection one) is a valid replacement, which is all that quote seems to imply. But I wouldn't call it "the proper way", or even the "best way".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|