COM Interop problem 
Author Message
 COM Interop problem

Does anyone know why the following code won't work? Every time I run it, I
get the following error message:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in AcadTestApp.exe

Additional information: Error loading type library/DLL.

Here's the code itself:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

        Dim p1 As Double() = New Double(2) {0, 0, 0}
        Dim p2 As Double() = New Double(2) {1, 1, 0}
        Dim acadApp As AutoCAD.AcadApplication
        Dim line As AutoCAD.AcadLine

        acadApp = GetObject(, "AutoCAD.Application")
        line = acadApp.ActiveDocument.ModelSpace.AddLine(p1, p2)
        line.Color = AutoCAD.ACAD_COLOR.acBlue

    End Sub

I've imported the AutoCAD type library to create Interop.AutoCAD.dll and the
object model shows correctly but when I enter break mode and look at the
active document, all the properties are reported as an error.

Any ideas?


Good judgement comes from experience.
Experience comes from bad judgement.

Sun, 02 May 2004 06:04:08 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Com interop problem with Framework 1.1

2. Com/Interop problem

3. COM Interop problem

4. COM interop problems

5. COM Interop problem

6. Problem passing VB COM+ ASP Request object to .NET component System.Web.HTTPRequest through COM interop

7. COM interop or vbscript problem

8. COM interop or VBScript problem

9. Automation error referencing .net dll from com (com interop)

10. COM Interop question

11. Strong named COM Interop

12. ParamArray and COM Interop


Powered by phpBB® Forum Software