[ComVisible(true)]
[Guid("1EB35E9B-60EE-4A26-BAEB-6A2D7AC32FF0")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class FooThingy
{
private object _value;
public object Value
{
get
{
return _value;
}
set
{
_value = value;
}
}
public FooThingy()
{
}
}
And I call it via the simplest VB6 code. I have added line numbers for easy reference.Public Sub Main()
1 Dim foo As FooThingy
2 Set foo = New FooThingy
3 If (foo.value <> "hello") Then
4 foo.value = "Testing"
5 End If
End Sub
At line 4 it fails with a runtime error 424 "Object required" yet line 3 evaluates with no problem. I know VB6 has this weird distinction between Property Let and Property Set and I'm guessing that is somehow related. What I need to figure out is how do I get my C# class to work with the VB6 code above. Perhaps there's some kind of marshaling declaration that will do the trick? I'm really hoping there's an answer to this because my alternative is to go through this very old VB6 program that was very badly written and find all the places where assignment is being done and replace it with a SetValue() method call which DOES work.
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.