Solved

Interface Implements Interface

Posted on 2006-11-07
2
674 Views
Last Modified: 2008-01-09
In Visual Basic 6.0 / Visual Basic for Applications, is there a way to have an interface extend another interface?  For example, suppose that there is a class module named InterfaceA that contains the following code:

    Public Sub MyMethod()
    End Sub

Now suppose that there is a class module named InterfaceB that contains the following code:

    Implements InterfaceA
    Public Sub InterfaceA_MyMethod()
    End Sub

When I write another class module that contains the following code:

    Implements InterfaceB
    Public Sub InterfaceB_InterfaceA_MyMethod()
    End Sub

I get the following error message when I compile:

    Compile error:

    Object module needs to implement 'InterfaceA_MyMethod' for interface 'InterfaceB'

Could you please tell me what I am doing wrong?  Thank you.
0
Comment
Question by:deatc
2 Comments
 
LVL 4

Accepted Solution

by:
JRCSystems earned 250 total points
ID: 17894843
Yeah, isn't this fun.
VB cannot and will not implement an Interface that has an _Underscore already in it.

Because B --> implemented A, which was MyMethod.
B's implementation of A is InterfaceA_MyMethod.
You MAY have complicated the situation by making that PUBLIC.
Typically, as Sick as it sounds, that stuff is PRIVATE, and jumped into via a V-table through a Type Library.

Try making you PUBLIC Sub InterfaceA_MyMethod, PRIVATE.
Believe it or not, this should solve it.

You MAY want to also try putting in class "C" this:
Implements InterfaceA
Implements InterfaceB

Ultimately, its the _ in the name that's killing the implementation.

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now