Wrox Programmer Forums
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 24th, 2005, 05:51 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default COM Interoperability

In a Microsoft knowledge base article (http://support.microsoft.com/?kbid=813809), I was led to use the following code:
Public Interface _clsOracleDisEmail
    Property ToName() As String
    Property ToAddress() As String
    Property FromName() As String
    Property FromAddress() As String
    Property CC_Name() As String
    Property CC_Address() As String
    Property Subject() As String
    Property Message() As String
    Sub Send(ByRef c As ADODB.Connection)
End Interface

<ClassInterface(ClassInterfaceType.None)> _
Public Class clsOracleDisEmail : Implements _clsOracleDisEmail
But “ClassInterface” in “<ClassInterface(ClassInterfaceType.None)>” generates an error stating that it is an unknown type.

I have seen scads of documentation today in researching this, all of which gives just this same syntax.

What [u]is</u> the deal? How is this attribute supposed to be used, if its identity doesn’t exist, yet its identity needs to exist?
Old January 27th, 2005, 05:47 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts

You're almost there; you just need to add a

Imports System.Runtime.InteropServices
statement at the top of your code file, above the interface declaration.

Alternatively, you could do

<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)> _
Public Class clsOracleDisEmail
    Implements _clsOracleDisEmail
On a small, very pedantic note, Microsoft recommended best practice is for your interfaces to start with and I, so instead of having _clsOracleDisEmail you'd have something like IOracleDisEmail. However, it's your code so you do what you like!

Also, to get rid of all compiler warnings, I had to add a reference to ADODB, because of the ADODB.Connection parameter in the Send method.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Article on Java and PHP interoperability ypomonh J2EE 0 August 2nd, 2007 05:28 PM
Com Interoperability problem(ASP.NET)Urgent deeptisingh20 General .NET 2 January 19th, 2006 08:34 AM
DTS Interoperability hwsc SQL Server DTS 1 January 11th, 2005 10:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.