Gurleen

Gurleen

  • NA
  • 1
  • 0

Error consuming Decimal field in VB 6.0 - "Out of Present range" Error

Dec 29 2005 6:07 PM
I am consuming a .NET webservice using C# ( using wsdl.exe) and then
exposing the resulting class as a COM component. Everything works fine
but the DECIMAL types give problem. I marshal them as Currency but
while consuming them in VB6.0 I get "out of present range" error. The
error is only present when I try to get the value  not when I try to
set it. I have read something about Decimal being 128 bit structure
whereas Currency only being 64 bits. But shouldn't marshaling take care
of it?  Any help would be appriciated.

Example Use of Attribute :

[MarshalAs(UnmanagedType.Currency)]
public Decimal Tax;

When I look up the typelibrary in OLEVIEW I see the following for Get and Set

[id(0x6002000f), propget]
HRESULT CityTax([out, retval] CURRENCY* pRetVal);

[id(0x6002000f), propput]
HRESULT CityTax([in] CURRENCY pRetVal);

Thanks