Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 296093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:31:01+00:00 2026-05-12T06:31:01+00:00

I have an older VB6 project that I’m trying to add unit tests for.

  • 0

I have an older VB6 project that I’m trying to add unit tests for. I was breaking dependencies in classes by mocking objects. Everything was going great until I found some dependencies that were raising events and now I’ve hit a wall.

Here’s a quick example of what I’m trying to do that DOESN’T WORK:

ITab.cls:

Option Explicit

Public Event Click(tabNumber As Integer)

Public Sub SomeOtherFunction()

End Sub

clsRealTab.cls:

Option Explicit
Implements ITab

Public Event Click(tabNumber As Integer)

Public Sub ITab_SomeOtherFunction()
    'code here'
End Sub

frmMain.frm:

Option Explicit

Private WithEvents mTab as ITab

Public Sub Main()
    Set mTab = New clsRealTab 'gives "Object or class does not support the set of events" error'
End Sub

Does anybody know if there’s a way to make this work or another way to go about handling this situation?

I implemented a callback interface that I called ITabEventsHandler. It looks like this:

Option Explicit

Public Sub Click(intPreviousTab As Integer, objSSTab As Object)

End Sub

Then I added Implements ITabEventsHandler to my form and pass the form as an ITabEventsHandler parameter to my clsTab initializer. Instead of raising a custom Click(...) event, I can just call mTabEventsHandler.Click(...).

Thanks for the suggestion!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:31:02+00:00Added an answer on May 12, 2026 at 6:31 am

    You can’t “implement” source interfaces in VB6 at all. So the short answer is “no, you can’t do this”. You can hack it with direct typelib editing but this will become ugly very quickly.

    You can consider callback interfaces in your case if you have to “implement” these by different (mock) classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an older project that uses the sun.net.ftp.FtpClient class to download a file
I have a project that adds elements to an AutoCad drawing. I noticed that
Currently I have two MediaWikis, one a slightly older version than the other. I
We need to get data out of an older accounting system. We have received
What is the best practice to implement the following: we have a classes Order
I have a large database of normalized order data that is becoming very slow
We are adding French support to an older VB6 app. The original developer used
I have a VB.NET app that is behaving strangely (or perhaps not strangely at
I have some older AS2-style Haxe code which uses flash.Lib.Current.CreateEmptyMovieClip() to create a slideshow
We have built a Windows Service that is running on client's machines, which occasionally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.