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

  • Home
  • SEARCH
  • 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 5976857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:17:16+00:00 2026-05-22T21:17:16+00:00

I have a .NET assembly that has routines that need to be called from

  • 0

I have a .NET assembly that has routines that need to be called from a VB6 dll. The .NET assembly’s routines, for other .NET code will return Lists of objects. However that won’t work for VB6. So I am using Interop to create a “vb6 class” that will return the data needed. I had read that the VB.NET Collection is compatible with the VB6 Collection, but I’ve found that to be untrue. My simple test consists of:

.NET Code:

<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class MyCOMClass

    Public Function TestMe() As Microsoft.VisualBasic.Collection
        Dim ret As New Microsoft.VisualBasic.Collection

        Dim inParam As String = "Stuff "
        ret.Add(inParam)
        ret.Add(inParam & "2")
        ret.Add(inParam & "3")
        ret.Add(inParam & "4")

        Return ret
    End Function


End Class

VB6:

Dim a As MyDotNet.MyCOMClass

Set a = New MyDotNet.MyCOMClass

Dim c As Collection

Set c = a.TestMe()

At this line, I’m receiving a “Type Mismatch, Error 13” error.

I’m kind of at a loss. I basically need to return a list or array of items from the .NET code – I’m already going to have to pack the existing .NET class object into a string or something to return to VB6 (which will then have to unpack it), so I was trying to make it slightly easier on myself.

Any suggestions or hints will be appreciated!

Thanks.

  • 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-22T21:17:17+00:00Added an answer on May 22, 2026 at 9:17 pm

    Microsoft.VisualBasic.Collection is compatible member-wise, but it’s not the same type.

    Why not just return an array? Of strings, or of your COM-visible .NET classes?
    Or create an indexed property?


    Having that said, why not return IList in the first place? IList is COM-visible.
    This works:

    <Microsoft.VisualBasic.ComClass()> _
    Public Class Class1
    
        Public Function Test() As IList
            Dim l() As String = New String() {"abc", "def", "42"}
            Return l
        End Function
    
    End Class
    

     

    Private Sub Command1_Click()
      Dim c As New ClassLibrary1.Class1
    
      MsgBox c.Test(2)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET assembly DLL that is created on-the-fly from pre-compiled code in
I have a c# .NET assembly that gets called from a C++ COM client.
I have a .NET assembly that has tens of classes and methods which are
I have a .net assembly that contains data access code (a bunch of Typed
I have a .net assembly that has a COM+ ServicedCopmonent in it and at
I have a ASP.net application that is referencing a external assembly that I need
I have an assembly (class library project in .Net 3.5) that has some references
I have a .NET assembly that needs to be 32-Bit and needs to be
I have a ASP.NET MVC application which is build up as an assembly that
I have a .NET 3.5 assembly, a DAL, that connects to a database through

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.