VB10, Auto-Implemented Properties and COM

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


Public Property FirstName As String
        return _strFirstName
    End Get
        _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:

<ComVisible(True)> _
<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class Class1
    Private prop As Boolean
    Public Property BoolProp() As Boolean
            Return prop
        End Get
        Set(ByVal value As Boolean)
            prop = value
        End Set
    End Property

    Public Property BoolProp2() As Boolean
End Class

With commands:

tlbexp ClassLibrary1.dll oleview ClassLibrary2.tlb

Produces this interface dump:

interface _Class1 : IDispatch {
    [id(00000000), propget,
      custom(54FC8F55-38DE-4703-9C4E-250351302B1C, 1)]
    HRESULT ToString([out, retval] BSTR* pRetVal);
    HRESULT Equals(
                    [in] VARIANT obj, 
                    [out, retval] VARIANT_BOOL* pRetVal);
    HRESULT GetHashCode([out, retval] long* pRetVal);
    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. You are doing something wrong, no idea what.

Need Your Help

How split and extract elements to get a new data.frame


I want to split a one column data.frame to form a new data.frame with two columns ,for example, thanks!I need a efficient way to solve because original data sets about 10Million rows

how to set path to php with min32w

php windows composer-php

I'm running min32 on win7 on a flash drive named e: . My php interpreter is at e:\EasyPHP-12.1\php\php546x130717222153\php.exe.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.