Get Application EXE name in VS.2005

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

How does one get the name of the executable that is running in VS.2005
using VB.net. I have looked at the my.application object but I can
only find My.Application.Info.DirectoryPath which does not include the
executable name.

Thanks in Advance

Laurence
 
Larry said:
How does one get the name of the executable that is running in VS.2005
using VB.net. I have looked at the my.application object but I can
only find My.Application.Info.DirectoryPath which does not include the
executable name.

Thanks in Advance

Laurence

I use Application.ProductName.

Set in the Assembly Info window.
 
Larry said:
How does one get the name of the executable that is running in VS.2005
using VB.net. I have looked at the my.application object but I can
only find My.Application.Info.DirectoryPath which does not include the
executable name.

Thanks in Advance

Laurence

Sorry, misread your question. The EXE filename should be in:

Application.ExecutablePath

An easy way to glean out the EXE filename, use the FileInfo class.
 
Is that My.application.ExecutablePath?

I don't see it in the my.application object,
nor do I see an Application object any where.

Laurence
 
its just as Zach said

Me.Label1.Text = Application.ExecutablePath

no me, no my, just Application
 
Laurence said:
Is that My.application.ExecutablePath?

I don't see it in the my.application object,
nor do I see an Application object any where.

Laurence

Not sure what is going on. I enter Application and hit the dot, and a
list of properties show up from Intellisense.
 
yea, its supposed to. Not everything has to start with "Me" or "My"....im
confused on what your confused about?
 
i keep thinking of more ways to explain it....

Application is under the System namespace, and since your importing the
System namespace automatically, its the same as typing

System.Application


hope that explains it a lil better
 
there are Objects and Classes that arent part of your form or project...so
they cant be accessed using "Me.". Application is a good example of that.
There are many many many more things that are accessed without the Me (or My
in 2005) keyword(s)....
 
When I type "Application" I do not get a "." or intellisense,
I do have Windows.Systems.Forms under my references folder.

Is it because this is a class Library project?

I created a new windows project and when I type "Application"
I do get the dot and intellisense.

There must be something different about a Class library project.

Thank You for you help.

Laurence
 
When I type "system.Windows.Forms.Application." then I get the dot
and intellisense.


I placed an "Inherits System.Windows.Forms.Form"
at the top of the class, but typing in "Application."
still doesn't do anything, I still have to
type "system.Windows.Forms.Application."

Laurence
 
I put in an "imports.System.Windows.Forms"
and now it is working,

Thank You for your help,

Laurence
 
Larry said:
I put in an "imports.System.Windows.Forms"
and now it is working,

Thank You for your help,

Laurence

Don't tell us, your app is not a standard windows app, right? Maybe a
Console app? If you create an using the standard windows application
template, System.Windows.Forms is automatically included and you do not
have to Imports it anywhere.
 
My App is a class library, to be compiled into a DLL.

If you create a new project as a windows app, it comes with the
System.Windows.Forms.

When you create a new project as a Class Library, it doesn't come with
System.Windows.Forms. Even when you add a reference to the
system.windows.forms under a reference folder, you still
have to have "Imports System.Windows.Forms"
to get at the Application Object.

Laurence
 
Back
Top