convert Application.Path from VBA to .net

convert Application.Path from VBA to .net

wesbird
Collaborator Collaborator
472 Views
4 Replies
Message 1 of 5

convert Application.Path from VBA to .net

wesbird
Collaborator
Collaborator
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
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
0 Likes
473 Views
4 Replies
Replies (4)
Message 2 of 5

jbooth
Advocate
Advocate
What you are probably looking for is in the System.Windows.Forms namespace:

System.Windows.Forms.Application.StartupPath
0 Likes
Message 3 of 5

Anonymous
Not applicable
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
0 Likes
Message 4 of 5

Anonymous
Not applicable
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
0 Likes
Message 5 of 5

wesbird
Collaborator
Collaborator
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
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
0 Likes