Author Topic: Type 'CommandMethod' is not defined -VB.Net VS2005  (Read 5494 times)

0 Members and 1 Guest are viewing this topic.

mkweaver

  • Bull Frog
  • Posts: 352
Type 'CommandMethod' is not defined -VB.Net VS2005
« 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

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #1 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")> _
« Last Edit: June 04, 2008, 09:16:04 AM by Daniel »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #2 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.

mkweaver

  • Bull Frog
  • Posts: 352
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #3 on: June 04, 2008, 09:28:24 AM »
...
Imports Autodesk.AutoCAD.Runtime
...

That did it.  I should have seen that one.

Thanks,
Mike

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #4 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  :-)

sinc

  • Guest
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #5 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

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Type 'CommandMethod' is not defined -VB.Net VS2005
« Reply #6 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
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)