vb.net - VB10, Auto-Implemented Properties and COM -
i finished class we're using tie access wcf services. of course means .net classes (and of properties) need visible com. given i'm using vb10 , contact class has 20 properties went ahead , used auto-implementing properties.
much surprise, properties not accessible within vba in access. tried marking properties comvisible (which didn't have in past standard properties) , still didn't work. after changing auto properties standard properties worked.
public property firstname string
became
public property firstname string return _strfirstname end set _strfirstname = value end set end property
my understanding 2 should equivalent. according i've read on msdn, auto-implementing properties take care of creating backing field , getter / setter , intents , purposes should same.
clearly they're not, else going on behind scenes?
they are. sample code:
<comvisible(true)> _ <classinterface(classinterfacetype.autodual)> _ public class class1 private prop boolean public property boolprop() boolean return prop end set(byval value boolean) prop = value end set end property public property boolprop2() boolean end class
with commands:
tlbexp classlibrary1.dll
oleview classlibrary2.tlb
produces interface dump:
interface _class1 : idispatch { [id(00000000), propget, custom(54fc8f55-38de-4703-9c4e-250351302b1c, 1)] hresult tostring([out, retval] bstr* pretval); [id(0x60020001)] hresult equals( [in] variant obj, [out, retval] variant_bool* pretval); [id(0x60020002)] hresult gethashcode([out, retval] long* pretval); [id(0x60020003)] hresult gettype([out, retval] _type** pretval); [id(0x60020004), propget] hresult boolprop([out, retval] variant_bool* pretval); [id(0x60020004), propput] hresult boolprop([in] variant_bool pretval); [id(0x60020006), propget] hresult boolprop2([out, retval] variant_bool* pretval); [id(0x60020006), propput] hresult boolprop2([in] variant_bool pretval); };
it's there. doing wrong, no idea what.
Comments
Post a Comment