Message 1 of 25
Accessing AutoCAD via a VB .NET form
Not applicable
11-30-2005
11:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on an existing program that a colleague of mine started and I have inherited to make work (the employee is no longer with our company). It is a VB Windows Application project that contains a form. The form allows the user to browse and select dwg files that will then be used to create plot files. I am running into an error message when I first try to access AutoCAD. Here is what I have so far:
Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports acadApp = Autodesk.AutoCAD.ApplicationServices.Application
Public Class frmMain
Inherits System.Windows.Forms.Form
Public dwgBrowse As String
Public pltBrowse As String
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'load set defaults for paper tabs
Me.Text = "PBK Plot Utility " & System.Windows.Forms.Application.ProductVersion
End Sub
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
Dim x As Integer
Dim sWait As Integer = 0
acadApp.MainWindow.Visible = True
End Sub
There is a lot more to the program (I haven't included all the routines that browse and select files, for example), but this is what I'm trying to accomplish right now. When the program gets to the line:
acadApp.MainWindow.Visible = True,
It highlights the line:
Public Class frmMain
And I get the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.windows.forms.dll
Additional information: File or assembly name acmgd, or one of its dependencies, was not found.
I have loaded acmgd.dll and acdbmgd.dll into the References. I am running AutoCAD 2006 and Visual Studio 2003. Any help would be greatly appreciated.
Thanks,
Christy
Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports acadApp = Autodesk.AutoCAD.ApplicationServices.Application
Public Class frmMain
Inherits System.Windows.Forms.Form
Public dwgBrowse As String
Public pltBrowse As String
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'load set defaults for paper tabs
Me.Text = "PBK Plot Utility " & System.Windows.Forms.Application.ProductVersion
End Sub
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
Dim x As Integer
Dim sWait As Integer = 0
acadApp.MainWindow.Visible = True
End Sub
There is a lot more to the program (I haven't included all the routines that browse and select files, for example), but this is what I'm trying to accomplish right now. When the program gets to the line:
acadApp.MainWindow.Visible = True,
It highlights the line:
Public Class frmMain
And I get the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.windows.forms.dll
Additional information: File or assembly name acmgd, or one of its dependencies, was not found.
I have loaded acmgd.dll and acdbmgd.dll into the References. I am running AutoCAD 2006 and Visual Studio 2003. Any help would be greatly appreciated.
Thanks,
Christy