Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a bit of open source that im trying to get working. I have imported and registred the proper dll files as instructed and now to my surprise there is no more errors in the project untill it comes time to debug it.

the part of code that has the exception in it is:
VB
Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
        Protected Overrides Sub OnCreateMainForm()
            Me.MainForm = Global.Shield.Form1
        End Sub

Me.mainform = Global.shield.form1 gives the error.......

An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'Interop.MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I need this program to run very badly to help with my program and to get a start in some very complex areas that I have not much expierence with. Can anyone solve my problem or tell me whats going on?
Posted
Updated 28-Dec-10 21:55pm
v2

I would suggest that your first port of call should be where you got the open source code from. They will have a lot more experience with it than anyone here.

Otherwise, we would have to examine the source code (which we don't have) and go through a learning curve ourselves!
 
Share this answer
 
Try AssemblyResolve. May be it would help.

VB
  Function CurrentDomain_AssemblyResolve(ByVal sender As Object, ByVal args As ResolveEventArgs) As Reflection.Assembly
  Try
    Return Reflection.Assembly.LoadFrom(directoryToLookForDependencies & "\" & args.Name.Substring(0, args.Name.IndexOf(",")) & ".dll")
  Catch ex As Exception
    Return Nothing
  End Try
End Function


Have a directory path in directoryToLookForDependencies

and in your form's load event
AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf CurrentDomain_AssemblyResolve
 
Share this answer
 
v2
Comments
Dale 2012 30-Dec-10 8:16am    
What are Dependencies? and in your code you have ".dll" which says its not a member of a string? can you please provide an example of what your saying here.... thank you very much for providing this and taking the time, thank you also to the first person who posted a comment......

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900