I have an executable program written in Visual Basic 2003. I now have a DLL written in Visual Basic 2005.
How do I call the 2005 DLL from the 2003 EXE I have tried Reflection and simply CreateObject. Even tried to create a reference. All attempts told me that the DLL was invalid.
Help please
Rory

Call a VB 2005 DLL from VB .NET 2003
Duane Haas
Do you have both the 1.1 and 2.0 framework installed on the machine.
As 2005 developed apps use V2 and 2003 apps use V1.1
What was the specific error it gave.
wanderingbob
Have you tried adding a config file to the .Net 1.1 dll to force it to use the .Net 2.0 runtime
If your exe is called yourfile.exe, create a file called yourfile.exe.config with the following contents:
< xml version ="1.0" >
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" safemode="true"/>
<requiredRuntime version="v2.0.50727" safemode="true"/>
</startup>
</configuration>
Place it under the same directory and give that a try.
Note that loading v2.0 dlls from the 1.1 .Net runtime is not supported.
CandyMe
The solution with the .config file will only work when you run the executable directly from the OS.
You won't be able to debug this executable from VS2003(aka play/run button) because the VS2003 debugger expects and uses the 1.1 Framework, and the config file specifies that it should be using the 2.0 Framework. If you don't add the config file, then the 1.1 Framework is loaded, in which case you can't load the 2.0 dll.
At any rate, why don't you just recompile the exectuable with the 2.0 Framework, where everything will work just fine
If you cant recompile the executable, you will need to debug it by either launching or attaching to it from the VS2005 debugger (with the config file specified).
Chicken Leg Willy
Adrian Foot
"The format of the file 'ELVEYAPI.DLL' is invalid."
both 1.1 and 2.0 installed. VB 2003 and VB 2005 installed
KRISTER
It is a VB 2005 DLL and the EXE is VB 2003.
I put your config settings into my application. However, the exe does not start then when I hit the run/play button. When I take those lines out, then the application starts fine. But the connecting to the DLL bombs out again.
Any ideas please
Rory