TheSwamp

Code Red => .NET => Topic started by: mkweaver on June 04, 2008, 08:33:22 AM

Title: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: mkweaver on June 04, 2008, 08:33:22 AM
Any suggestions on how to get started with VB.Net?  I've installed the Arx SDK, but that doesn't seem to help me with VB.  I've tried to install the templates that come with Jerry Winters VB book, but the install fails - works fine on my machine at home (vs2005 Express).

Thanks in advance,
Mike
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: It's Alive! on June 04, 2008, 09:08:37 AM
Did you happen to find the vb.net samples in the ARXSDK? 
In your project,  make sure you have AcDbMgd.DLL and AcMgd.DLL referenced and copy local is set to false (they are in your ACAD directory) . 
You may need to add a line like.

Imports Autodesk.AutoCAD.Runtime

...

<CommandMethod("doit")> _

Or

<Autodesk.AutoCAD.Runtime.CommandMethod("doit")> _
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: It's Alive! on June 04, 2008, 09:15:05 AM
Also, if you downloaded the ARX SDK for 2009, there is a help file in the Docs folder called arxmgd.chm.
This file has a list of all the managed classes with descriptions.
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: mkweaver on June 04, 2008, 09:28:24 AM
...
Imports Autodesk.AutoCAD.Runtime
...

That did it.  I should have seen that one.

Thanks,
Mike
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: It's Alive! on June 04, 2008, 09:43:16 AM
...
Imports Autodesk.AutoCAD.Runtime
...

That did it.  I should have seen that one.

Thanks,
Mike

My pleasure,

Just a note, Unlike C++ #include declarations, .NET using/import statements do not cause code bloat.
So I just add the items I commonly use.. I.e

C#
Code: [Select]
#region #Using delarations
using System;
using System.Collections.Generic;
//using System.Linq; //vs2008
using System.Text;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
using System.Threading;
using System.Globalization;
using System.Reflection;
using System.Drawing.Imaging;

using Autodesk.AutoCAD.GraphicsInterface;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.LayerManager;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Colors;

//using AcExtensions; mine

using AcAp = Autodesk.AutoCAD.ApplicationServices;
using AcEd = Autodesk.AutoCAD.EditorInput;
using AcGe = Autodesk.AutoCAD.Geometry;
using AcRx = Autodesk.AutoCAD.Runtime;
using AcDb = Autodesk.AutoCAD.DatabaseServices;
using AcWd = Autodesk.AutoCAD.Windows;
#endregion



[assembly: CommandClass(typeof(ExecMethod.Paths))]
namespace ExecMethod
{
  public class Paths
  {
   ...
  }
}

PS, get a good C# to VB.NET translator  :-)
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: sinc on June 04, 2008, 11:46:36 AM
PS, get a good C# to VB.NET translator  :-)

You mean there's a good one?   :-D
Title: Re: Type 'CommandMethod' is not defined -VB.Net VS2005
Post by: David Hall on June 04, 2008, 02:17:51 PM
what I do, not that its right, and I'm going the other way, is copy paste the VB code into VB Express 2008, compile it, and open that DLL with Reflector and look at it from a C# perspective to get an idea of what I'm supposed to be doing.  Hope that gives you some direction