I have a C# application that reference a VB6 dll. When I pass null from C# into VB6 dll function, the null is translated as value Empty (value) in VB6, instead of Nothing (object). For example:
// function in vb6 dll that referenced by c# app
Public Sub TestFunc(ByVal oValue As Variant)
{
...
if oValue is Nothing then
set oValue = someObject
end if
...
}
// main c# code
private void Form1_Load(object sender, EventArgs e)
{
object testObject = new object();
testObject = null;
TestFunc(testObject);
}
When I pass an object (not null) then it will be passed into the VB6 as object. But when null passed into vb6, it becomes value type Empty, instead of object type Nothing. Any one knows why? and is there anyway I can force null as Nothing in VB6 when passed from c# app?
Thanks a lot.