Thanks Nicholas
I gave it a try but still I get ??????????????? ?????? as the value of the
methods parameter.
Here is the VB6 Method that makes the call :
Public Function Reconstruct(dat a As String) As String
Dim reco
Set reco =
CreateObject("I conGlobal.Carel inkPlus.Reports Utilities.Cryst alReportsUtilit y
")
Reconstruct = reco.Reconstruc tData(data)
End Function
Is that all I need to do to make a call to the managed code (it was in the
example I have - using late binding).
Also I should mention that the string being passed to the VB method is being
passed from
a Crystal Reports formula (the vb method is part of a Crystal UFL).
Thanks
S
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:u$******** ******@TK2MSFTN GP10.phx.gbl...
awk,
I assume you are using COM interop to access the C# method in VB6.
Your method needs to be attributed like this:
[return:MarshalA s(UnmanagedType .BStr)]
public string MyMethod([MarshalAs(Unman agedType.BStr)] string param1);
While I think that it does this by default (if you are using com
interop), this should explicitly set it.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"awk" <si*********@mb ox.com.au> wrote in message
news:Oi******** ******@tk2msftn gp13.phx.gbl... Hi All
I have a com dll written in VB6 (it's a User Function Library for my
crystal reports - this allows me to write custom functions for Crystal
which can be applied in Crystal formulas - none of this is relevant to
the problem though (((I think)))).
Anyway, the VB dll has one method that takes a string as an argument and
returns a string. It passes the string arg to a C# library
which is where the problem lies. The string arg contains unicode data
and when it passes it to the c# managed code the unicode is lost
and turns into ??????????????? ? characters which means the c# code
doesnt know what to do with it (it needs the unicode string). Therefore I think
that the marshalling process of the string from vb dll to c# dll is my
issue. What do I have to do to marshall this string properly? Should I
be marshalling it as a string or perhaps a byte[].
Any help greatly appreciated
S