Distinguished Contributor
Posts: 359
Registered: ‎12-05-2003
Message 1 of 3 (118 Views)

Where to start?

118 Views, 2 Replies
09-15-2005 12:15 PM
This is my first time here. I have built a in-house project in VBA for 6 months. I use a lot of functions in CAO (dbConnect). Now the company I work for plan to sell it. Now I have some questions:
I'm required make my routine work with another component which wrote by another programmer in .Net. It will be good if I migrate my code to .Net. So what kind of method I should go with:
a. if I plan to make my routine work with 2004, I have to use COM and interop. if 2006, I can use some neat, power, AutoCAD built-in .Net functions. so beside the market popularity, what other factor should I consider?
b. Which version of Visual Studio .NET should I start, 2002, 2003, or 2005? is 2005 Express version good for production?
c. which language should I go for, VB.NET or C#?
d. Instead of rewriting all the code, is there any easy way to migrate VBA code to VB.NET? I don't think cut_n_paste will work, is it correct? How long it properly take at least?
e. Is there anybody work with CAO in .NET? I can not find any documentation in the ObjectARX Reference. Is there any sample?

Thank you in advance
Wes Message was edited by: weslleywang
Vault Pro 2014, Windows 7 64 bit, AutoCAD (ACA, Map) 2014
Distinguished Contributor
Posts: 1,691
Registered: ‎12-15-2003
Message 2 of 3 (118 Views)

Re: Where to start?

09-15-2005 04:07 PM in reply to: wesbird
If your programming background is VBA I would choose VB.NETand have a look at this free book from Microsoft. http://msdn.microsoft.com/vbrun/staythepath/additionalresources/upgradingvb6/
Basically I would choose the language with the syntax you like.

If you will still be using the ActiveX API you should be able to copy and paste code and then make the necessary modifications such as changing variable types, modifying references to ThisDrawing & replacing On Error statements with Try blocks.

Regards - Nathan
Distinguished Contributor
Posts: 311
Registered: ‎07-29-2004
Message 3 of 3 (118 Views)

Re: Where to start?

09-16-2005 05:46 AM in reply to: wesbird
a. The dotnet api for Autocad can do much more than com.

b. You can use 2002,2003, or 2005 if you only do vb.net or C#. To use C++ and objectarx or OMF you need VS2002. I prefer the professional version to have C++.

c. If you already know VB, vb.net will be an easier transition.

d. You can convert a project, but it will add a lot of "compatability" objects that are old and typically can be replaced with a better dotnet object. I recommend translating the code manually.

e. CAO is an activex dll, so you can use it from dotnet. There should be some samples in the Autocad Program directory. I have ADT so it is at
C:\Program Files\Autodesk Architectural Desktop 2006\Sample\Database Connectivity\CAO.

Chris Arps
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.