.NET

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

convert Application.Path from VBA to .net

118 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 (118 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 (118 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 (118 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: 347
Registered: ‎12-05-2003
Message 5 of 5 (118 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community