Shane James wrote:
If I put the reader = New Reader() in the connect sub, the error goes away, but nothing works like it should. it doesnt pick up the events or anything
This is normal: you create a new instance of the Reader class but this one is not configured like the first one was in the constructor of Results_Capture_Enduro
. But I don't think the problem is here, you should remove this line. You did not tell us which variable triggers the exception. To find it you can remove the try...catch block around the call to connect() to let the debugger stop at the line the exception occurs. There is one line where the VB code is not equivalent to its C# counterpart:
Dim readerDeviceInfo As ReaderDeviceInfo = CType((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
The strictly equivalent version would be:
Dim readerDeviceInfo As ReaderDeviceInfo = DirectCast((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
See this article: DirectCast vs. CType[^] for explanations. In general using CType for a simple type cast is dangerous because it will try to do something even if the cast is not possible, so that the error may propagate to other parts of the code where it is difficult to understand. NB. Also be careful when translating from C# to VB.NET as the latter is not really case sensitive which may cause compilation errors: vb.net - Is VB really case insensitive? - Stack Overflow[^]