Solved

Interface Implements Interface

Posted on 2006-11-07
2
682 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 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