0
votes

I've written a DLL that provides methods for extracting data from a MySQL DB and generating a report using the built-in report viewer in VS 2012. The idea is to use this in a VB6 program. I've gone through the following process:

1) Build the DLL in VS with "register for COM interop" selected

2) Placed the DLL and TLB file in the directory of the VB6 program on another machine

3) Used regasm: "regasm Report.dll /tlb: Report.tlb /codebase" (redundant step if I already have the TLB file generated by VS?)

4) Added the TLB file to project references in VB6

The VB6 program builds and executes okay, but when I got to run my report I just get "Automation error: the system cannot find the file specified".

I've gone through the above process for a trivial DLL according to the instructions given here. This worked fine. I suspect that the references used in my DLL (MySQL.Data and Microsoft.ReportViewer.WinForms) may also need to be registered on the VB6 machine. I've been able to do this with MySQL.Data but not the ReportViewer DLL.

If it makes a difference, the DLL was built on a Windows 7 64 bit machine whereas the VB6 machine runs XP 32-bit.

Thanks in advance.

1
Can you create the smallest amount of VB6 code reproducing the error, and indicate which line it falls over on?Mark Bertenshaw

1 Answers

0
votes

Turned out the problem was that I needed to set the Copy Local property for Microsoft.ReportViewer.Common and copy the relevant DLL files along with my own DLL. Hope this helps anyone with a similar problem.