I recently finished a class that we’re using to tie Access to some WCF Services. Of course this means that the .Net classes (and all of their properties) need to be visible to COM. Given that I’m using VB10 and the Contact class has about 20 properties I went ahead and used auto-implementing properties.
Much to my surprise, the properties were not accessible from within VBA in Access. I tried marking the properties as ComVisible (which I didn’t have to do in the past with standard properties) and it still didn’t work. After changing the auto properties to standard properties everything worked.
Public Property FirstName As String
Became
Public Property FirstName As String
Get
return _strFirstName
End Get
Set
_strFirstName = value
End Set
End Property
My understanding is that the two should be equivalent. According to what I’ve read on MSDN, auto-implementing properties simply take care of creating the backing field and getter / setter for you and for all intents and purposes they should be the same.
Clearly they’re not, so what else is going on behind the scenes?
They are. Some sample code:
With commands:
Produces this interface dump:
It’s there. You are doing something wrong, no idea what.