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 8925275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:39:04+00:00 2026-06-15T07:39:04+00:00

I have a VB6 project that currently Compiles even though I am accessing a

  • 0

I have a VB6 project that currently Compiles even though I am accessing a Property that does not exist.

The code looks a bit like this:

Public vizSvrEmp As VizualServer.Employees
Set vizSvrEmp = New VizualServer.Employees

Fn = FreeFile
Open vizInfo.Root & "FILE.DAT" For Random As #Fn Len = RecLen
Do While Not EOF(Fn)
    Get #Fn, , ClkRecord
    With vizSvrEmp
        Index = .Add(ClkRecord.No)
        .NotAvailable(Index) = ClkRecord.NotAvailable
        .Bananas(Index) = ClkRecord.Start
        'Plus lots more properties
    End With
Loop

The Bananas property does not exist in the object yet it still compiles.
My vizSvrEmp Object is a .NET COM Interop DLL and is early bound and if I type the dot in I get the Intellisense correctly (which does not show Bananas)

I tried removing the With but that behaves the same

How can I make sure these errors are picked up by the compiler?

  • 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-06-15T07:39:05+00:00Added an answer on June 15, 2026 at 7:39 am

    I know you’ve got this sorted out with the help of Hans but just for completeness, the alternative to using ClassInterface(ClassInterfaceType.AutoDual) is to use ClassInterface(ClassInterfaceType.None) and then Implement an explicit interface that is decorated with InterfaceType(ComInterfaceType.InterfaceIsDual)>.

    It is more work, but gives you complete control over the interface GUIDs. The AutoDual will auto generate unique GUIDs for the interfaces when you compile, which is time saving but you don’t have control over them.

    In use, this would look something like this:

    <ComVisible(True), _
    Guid(Guids.IEmployeeGuid), _
    InterfaceType(ComInterfaceType.InterfaceIsDual)> _
    Public Interface IEmployee 
    
       <DispIdAttribute(1)> _
       ReadOnly Property FirstName() As String
    
       <DispIdAttribute(2)> _
       ReadOnly Property LastName() As String
    
       <DispIdAttribute(3)> _
       Function EtcEtc(ByVal arg As String) As Boolean
    
    End Interface
    
    
    <ComVisible(True), _
    Guid(Guids.EmployeeGuid), _
    ClassInterface(ClassInterfaceType.None)> _
    Public NotInheritable Class Employee
       Implements IEmployee 
    
       Public ReadOnly Property FirstName() As String Implements IEmployee.FirstName
          Get
             Return "Santa"
          End Get
       End Function
    
       'etc, etc
    
    End Class
    

    Note how the GUIDs are declared. I find creating a helper class to consolidate the GUIDs and provide Intellisense works out well:

    Friend Class Guids
       Public Const AssemblyGuid As String = "BEFFC920-75D2-4e59-BE49-531EEAE35534"   
       Public Const IEmployeeGuid As String = "EF0FF26B-29EB-4d0a-A7E1-687370C58F3C"
       Public Const EmployeeGuid As String = "DE01FFF0-F9CB-42a9-8EC3-4967B451DE40"
    End Class
    

    Finally, I use these at the assembly level:

    'The following GUID is for the ID of the typelib if this project is exposed to COM
    <Assembly: Guid(Guids.AssemblyGuid)> 
    
    'NOTE:  The following attribute explicitly hides the classes, methods, etc in 
    '        this assembly from being exported to a TypeLib.  We can then explicitly 
    '        expose just the ones we need to on a case-by-case basis.
    <Assembly: ComVisible(False)> 
    <Assembly: ClassInterface(ClassInterfaceType.None)> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a VB6 project that compiles to an ActiveX EXE that happens to
we have a VB6 binary executable that comes with no source code. And we
I have a dll that I created from a VB6 project that I am
If you have an embedded resource in your VB6 project that contains a binary
I have an older VB6 project that I'm trying to add unit tests for.
I have a VB6.0 project that contains the line Implements IObjectSafety I tried reopening
Using VB6, I have created an Outlook plugin, that has a property page. The
I have a VB6 project that is using a SQL2008 database. The project consists
I have a project with some C# dlls that use other vb6 dlls. I
I have a VB6 project that I need to edit. I have downloaded the

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.