.NET

Reply
Distinguished Contributor
wesbird
Posts: 351
Registered: ‎12-05-2003
Message 1 of 5 (124 Views)

convert Application.Path from VBA to .net

124 Views, 4 Replies
02-21-2006 02:37 PM
Hi,
I am convert one of my project from VBA to .net (C#). now I have problem to convert
Application.Path
to C#. I look everywhere but I can not find it. Should I have to look in Reflection ?

I really appreciate your help

Wes
Distinguished Contributor
jbooth
Posts: 223
Registered: ‎02-17-2006
Message 2 of 5 (124 Views)

Re: convert Application.Path from VBA to .net

02-21-2006 02:43 PM in reply to: wesbird
What you are probably looking for is in the System.Windows.Forms namespace:

System.Windows.Forms.Application.StartupPath
*Mark Gardiner
Message 3 of 5 (124 Views)

Re: convert Application.Path from VBA to .net

02-21-2006 05:00 PM in reply to: wesbird
string sdllPath =
System.Reflection.Assembly.GetExecutingAssembly().Location;

wrote in message news:5092626@discussion.autodesk.com...
Hi,
I am convert one of my project from VBA to .net (C#). now I have problem
to convert
Application.Path
to C#. I look everywhere but I can not find it. Should I have to look in
Reflection ?

I really appreciate your help

Wes
*Tony Tanzillo
Message 4 of 5 (124 Views)

Re: convert Application.Path from VBA to .net

02-21-2006 09:45 PM in reply to: wesbird
Using System.Diagnostics;
Using System.IO;


{
string filename = Process.GetCurrentProcess().MainModule.FileName;
string path = Path.GetDirectoryName(filename);
}


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5092626@discussion.autodesk.com...
Hi,
I am convert one of my project from VBA to .net (C#). now I have problem to convert
Application.Path
to C#. I look everywhere but I can not find it. Should I have to look in Reflection ?

I really appreciate your help

Wes
Distinguished Contributor
wesbird
Posts: 351
Registered: ‎12-05-2003
Message 5 of 5 (124 Views)

Re: convert Application.Path from VBA to .net

02-22-2006 05:44 AM in reply to: wesbird
Thank Jason, Mark and Tony.
I tried all your code. Jason's and Tony's get exact what I want, like C:\Program Files\AutoCAD 2006
Mark's return the path of current dll file.



thank you all again.
Wes
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.