Home All Groups Group Topic Archive Search About

Get Application EXE name in VS.2005

Author
7 Aug 2006 6:22 PM
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

Author
7 Aug 2006 6:53 PM
zacks
Larry wrote:
> 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.
Author
7 Aug 2006 6:57 PM
zacks
Larry wrote:
> 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.
Author
7 Aug 2006 7:47 PM
Laurence
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

za***@construction-imaging.com wrote:
Show quoteHide quote
> Larry wrote:
>> 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.
>
Author
7 Aug 2006 7:57 PM
iwdu15
its just as Zach said

Me.Label1.Text = Application.ExecutablePath

no me, no my, just Application
--
-iwdu15
Author
7 Aug 2006 9:27 PM
Herfried K. Wagner [MVP]
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> Me.Label1.Text = Application.ExecutablePath
>
> no me, no my, just Application

It's 'System.Windows.Forms.Application'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
7 Aug 2006 10:25 PM
Larry
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



Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
>> Me.Label1.Text = Application.ExecutablePath
>>
>> no me, no my, just Application
>
> It's 'System.Windows.Forms.Application'.
>
Author
7 Aug 2006 10:34 PM
Larry
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

Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
>> Me.Label1.Text = Application.ExecutablePath
>>
>> no me, no my, just Application
>
> It's 'System.Windows.Forms.Application'.
>
Author
7 Aug 2006 10:50 PM
Larry
I put in an "imports.System.Windows.Forms"
and now it is working,

Thank You for your help,

Laurence

Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
>> Me.Label1.Text = Application.ExecutablePath
>>
>> no me, no my, just Application
>
> It's 'System.Windows.Forms.Application'.
>
Author
8 Aug 2006 12:26 PM
zacks
Larry wrote:
Show quoteHide quote
> I put in an "imports.System.Windows.Forms"
> and now it is working,
>
> Thank You for your help,
>
> Laurence
>
> Herfried K. Wagner [MVP] wrote:
> > "iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> >> Me.Label1.Text = Application.ExecutablePath
> >>
> >> no me, no my, just Application
> >
> > It's 'System.Windows.Forms.Application'.
> >

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.
Author
9 Aug 2006 1:21 AM
Laurence
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


za***@construction-imaging.com wrote:
Show quoteHide quote
> Larry wrote:
>> I put in an "imports.System.Windows.Forms"
>> and now it is working,
>>
>> Thank You for your help,
>>
>> Laurence
>>
>> Herfried K. Wagner [MVP] wrote:
>>> "iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
>>>> Me.Label1.Text = Application.ExecutablePath
>>>>
>>>> no me, no my, just Application
>>> It's 'System.Windows.Forms.Application'.
>>>
>
> 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.
>
Author
7 Aug 2006 7:57 PM
zacks
Laurence wrote:
> 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.

Show quoteHide quote
>
> za***@construction-imaging.com wrote:
> > Larry wrote:
> >> 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.
> >
Author
7 Aug 2006 8:22 PM
iwdu15
yea, its supposed to. Not everything has to start with "Me" or "My"....im
confused on what your confused about?
--
-iwdu15
Author
7 Aug 2006 8:34 PM
iwdu15
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
--
-iwdu15
Author
7 Aug 2006 8:58 PM
iwdu15
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)....
--
-iwdu15