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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:43:09+00:00 2026-05-20T09:43:09+00:00

I stumbled upon this while trying to build an ActiveX dll from an old

  • 0

I stumbled upon this while trying to build an ActiveX dll from an old (but still maintained) VB6 exe project(*) sources in order to perform some testing via COM / NET interop.


The (desired) use case is:

  1. Take a VB6 class with public methods taking or returning some control (for example CommonDialog) reference
  2. Compile this class into an ActiveX dll
  3. Create an instance of this class via COM interop from .NET and correctly call its methods

In short, the first problem is that having something like

Public Function bad_dlg() As CommonDialog
   Set bad_dlg = Nothing
End Function

in a Visual Basic 6 ActiveX dll‘s class file makes the compilation (* *) fail with the following error:

“Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types”


Hence, the question is:

  1. Is it really impossible to have something like above compile and run properly?
  2. [IF NOT] Suppose, I change everything to return and receive instances of VB6 Object type — how can I work with such an instance from .Net (call specific methods, etc)

(*) — not an ActiveX exe, just an “ordinary” one

(* *) provided that appropriate .ocx (“Microsoft Common Dialog Control 6.0 (SP6)”, C:\Windows\system32\ComDlg32.OCX) is referenced

(* * *) the only one that I have found is Passing control Ref to dll

  • 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-20T09:43:10+00:00Added an answer on May 20, 2026 at 9:43 am

    (As for the 1st part of the question)

    The Microsoft documentation (Data Types Allowed in Properties and Methods
    ) states:

    On the Evils of Returning Private Objects

    The following data types are not allowed, and references to them should never be returned to client applications:

    • All of the objects provided in the Visual Basic (VB) object library — for example, controls. Use the Object Browser to view the entire list.

    • All forms.

    • All class modules whose Instancing property is set to Private.

    • References to ActiveX controls.

    Visual Basic prevents you from passing non-visual private objects to or from out-of-process components. Attempting to do so causes error 98, “A property or method call cannot include a reference to a private object, either as an argument or as a return value.” This error is always received by the client.

    …

    IMPORTANT

    • Private objects are private for a reason, usually because they were not designed to be used outside your project. Passing them to a client may decrease program stability and cause incompatibility with future versions of Visual Basic. If you need to pass a private class of your own to a client, set the Instancing property to a value other than Private.

    [Deatails follow]

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

Sidebar

Related Questions

I stumbled upon this while doing a review and the author is not available:
I stumbled upon this question from two years ago. Is there a way to
So I'm trying to install a web application and I stumbled upon this question:
Hey, I stumbled upon this site looking for solutions for event overlaps in mySQL
I'm revisiting som old code of mine and have stumbled upon a method for
While playing around with one-to-one associations in castle activerecord I stumbled upon the following
Update : I just stumbled upon this in Eric Lippert's answer to another question
Today I stumpled upon the shadowCopyBinAssemblies option in the hostingEnvironment tag. Appearently this attribute
I just stumbled upon MainSoft's Grasshopper , which claims to cross-compile .Net ILM to
i recently stumbled upon a seemingly weird behavior that Google completely failed to explain.

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.