I'm trying to get a C# winforms DLL to work as a COM component.
All of my methods work fine, but the properties do not - I get the error
Object reference not set to an instance of an object.
All of the properties and methods in the interface below are marked public in the class that implements them.
[Guid("MY-GUID-IS-HERE")]
public interface IMyWinformsCOMComponent
{
String clientID { get; }
byte[] userID { get; }
string language { get; set; }
int productID { get; set; }
uint version { get; }
void thisWorksFine(string key, string value);
uint getValue();
void showTheForm();
}
Here is the vbscript sample that fails
Dim oMyWinformsCOMComponent
Set oMyWinformsCOMComponent = CreateObject("myNameSpace.MyWinformsCOMComponent")
'Works fine
Dim foo : foo = oMyWinformsCOMComponent.getValue()
'Works fine
oMyWinformsCOMComponent.thisWorksFine "myString", "myValue"
'Doesn't work
Dim lang : lang = oMyWinformsCOMComponent.language