Connect Autocad 2005 from VB .NET

Discussion in 'AutoCAD' started by Carlos Alba, May 4, 2004.

  1. Carlos Alba

    Carlos Alba Guest

    Hi there:
    I tried to connect to AutoCad 2005 from VB .NET with no results. My
    code is like this:

    Public cad As Object = Nothing
    ...
    ...
    Try
    cad = GetObject(, "AutoCAD.Application.16.1")
    Catch e As Exception
    Try
    cad = CreateObject("AutoCAD.Application.16.1")
    Catch ex As Exception
    MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
    End Try
    MsgBox(e.ToString, MsgBoxStyle.Exclamation)
    End Try

    The Exception error, translated, tells something like "Cannot create
    the ActiveX component". If I have an Autocad running, getObject works
    properly, but if it is not, my program does not create an Autocad
    instance and breaks.

    If anybody can help me ... :).
    Thanks in advance.
     
    Carlos Alba, May 4, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.