Using a great translator utility (http://authors.aspalliance.com/aldotnet/examples/translate.aspx) here is Tony's example converted to VB.NET
'////////////////////////////////////////////////////////////////< br>/// Commands.cs copyright (c) 2006 Tony Tanzillo
Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports AcadApp = Autodesk.AutoCAD.ApplicationServices.Application
_
Public Class Commands
Sub New()
End Sub 'New
Private ACAD_EXE As String = "acad.exe"
Private ACDB_XX_DLL As String = "acdb16.dll"
Private RTSTR As Short = 5005
Private RTNORM As Short = 5100
Private RTNONE As Short = 5000
Private RTREAL As Short = 5001
Private RT3DPOINT As Short = 5009
Private RTLONG As Short = 5010
Private RTSHORT As Short = 5003
Private RTENAME As Short = 5006
Shared
_
Function acedCmd(resbuf As IntPtr) As Integer
Public Shared Function Command(ParamArray args() As Object) As Integer
If AcadApp.DocumentManager.IsApplicationContext Then
Return 0
End If
Dim res As Integer = 0
Dim buffer As New ResultBuffer()
Try
Dim o As Object
For Each o In args
Dim code As Integer = 0
If TypeOf o Is String Then
code = RTSTR
Else
If TypeOf o Is Int32 Then
code = RTLONG
Else
If TypeOf o Is Int16 Then
code = RTSHORT
Else
If TypeOf o Is Double Then
code = RTREAL
Else
If TypeOf o Is Point3d Then
code = RT3DPOINT
Else
If TypeOf o Is ObjectId Then
code = RTENAME
End If
End If
End If
End If
End If
End If
If code <> 0 Then
buffer.Add(New TypedValue(code, o))
End If
Next o
If buffer.AsArray().Length > 0 Then
Dim cmdecho As Object = AcadApp.GetSystemVariable("CMDECHO")
AcadApp.SetSystemVariable("CMDECHO", 0)
res = acedCmd(buffer.UnmanagedObject)
AcadApp.SetSystemVariable("CMDECHO", cmdecho)
End If
Finally
buffer.Dispose()
End Try
Return res
End Function 'Command
Public Shared Function ZoomExtents() As Integer
Return Command("._ZOOM", "_E")
End Function 'ZoomExtents
End Class 'Commands
'/////////// Commands.cs ///////////////////////////////
Ronnie Wilkins, Jr.