Click here to Skip to main content
13,632,608 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am running VB2008 Express with 2 projects loaded.
1. A class - clsAcad which has a public New method.
2. A windows form to test class

Form has this code:
Private Sub Form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click
   Dim ac As New Acad2008.clsAcad
   Button1.Enabled = ac.Loaded
End Sub

Runtime error produces this:-
System.IO.FileNotFoundException was unhandled
  Message="The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
  Source="Acad2008"
  StackTrace:
       at Acad2008.clsAcad..ctor()
       at WindowsApplication1.Form1.Form1_Click(Object sender, EventArgs e) in C:\Users\Stuart\Documents\Visual Studio 2008\Projects\WindowsApplication1\Form1.vb:line 9
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
Posted 19-Mar-11 1:31am
Updated 19-Mar-11 1:56am
v2
Comments
Sander Rossel 19-Mar-11 8:25am
   
Could it be that the clsAcad class tries to open a file which is not found?
I also recommend putting a Try... Catch block around your code in the button click. In the Catch show a more elegant MessageBox. You do not want unhandled Exceptions.
Sergey Alexandrovich Kryukov 20-Mar-11 22:36pm
   
OP comment:
I don't think so.
I tried creating a simple class and no problem.
It was adding references to Autocad that seems to have done it.

Reading the AutoCad help file (not very helpful) it seems that the dll's I am referencing are designed to be in-process.
OriginalGriff 21-Mar-11 4:06am
   
Answer updated: Please use the "Reply" facility if you answer, rather than the "Solution" - that way I get an email to let me know!

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

A quick look on the internet suggest that it can be caused by trying to use two different version of the .NET framework.

Check that both the DLL containing clsAcad and the test utility are targeting the same version.


"Understood. Again AutoCad soes not support net framework 4 and suggest using VB2008, which I downloaded, and so I rewrote everything in VB2008 Express using 3.5
However it seems that Express does not allow debugging using an external program<"/b>

I assume from this comment that you downloaded VS2008 Express to compile it: If you already have the "proper" version of VS2010, you can just set the framework to V3.5 and compile it then. That would include full debugging.

I do not believe that VS2008 Express would be so limited: all you should have to do is include a reference to the ACAD assembly in your V3.5 project and it should work. I don't have it here to test, so can't check however. What did you do to get to this point?
  Permalink  
v2
Comments
Sergey Alexandrovich Kryukov 20-Mar-11 22:38pm
   
OP commented:

Understood. Again AutoCad soes not support net framework 4 and suggest using VB2008, which I downloaded, and so I rewrote everything in VB2008 Express using 3.5
However it seems that Express does not allow debugging using an external program

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.180712.1 | Last Updated 21 Mar 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100