I have a VB6 application that uses .NET code through a COMClass to read from the serial port. For this I use the .NET SerialPort class. When the SerialPort.Datareceived event is triggered I raise an paraemterless event that my VB6 application subscribes to.
All this is working perfectly during development. It is also working when I execute my application.exe on my local machine. When I execute the application.exe on another machine I get a System.Reflection.TargetException saying "object does not match target type"
Microsoft states that the SerialPort.Datareceived event is raised on another thread and I believe this could be the problem. You can read about it here: http://msdn.microsoft.com/da-dk/library/system.io.ports.serialport.datareceived.aspx
By now Im thinking that I cannot use an event-based approach and at the same time keep a responsive UI in my VB6 application, but what alternatives are there besides polling some shared storage from my VB6 application?
Any suggestions are greatly appreciated.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)