I have one C # DLL and one Visual Basic 6 DLL.
In C #, there is an x field with a Decimal data type. VB6 has a y field with the data type Currency .
What would be the best way to pass x to y and vice versa?
I am currently converting fields to Double , but I'm not sure if there are consequences of rounding.
Update 1:
Based on a helpful tip, this is my code as follows:
public void FromVbToNet(long vb6curr) { decimal value = vb6curr / 10000; }
The problem is that when I try to call this from VB6 via interop, I get a compilation error:
"A function or interface that is marked as restricted, or the function uses an automation type that is not supported in Visual Basic."
So how do I declare vb6curr? String , Object , Dynamic ?
Update 2:
If someone needs this for reference, after further reading, I came up with the following solution:
[return: MarshalAs(UnmanagedType.Currency)] public decimal GetDecimalFromNetDll() { decimal value = ...
I call this from my unmanaged code in VB6 with the Currency parameter, and everything seems to be working so far.
source share