Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Call the same class from an VB exe and from an asp

Posted on 1999-07-04
Medium Priority
Last Modified: 2010-05-02
I want to use the same class from vb exe application and from asp.
To use it in the exe application the class should be private class, and to use it from the asp (as an ActiveX) the class should be public (multi use).
Any solution?
Question by:efrataltshuler
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Author Comment

ID: 1521817
Edited text of question.
LVL 70

Expert Comment

by:Éric Moreau
ID: 1521818
Compile an ActiveX (DLL or EXE) which will contain your class instantiated as public multi-use (if this what you want).

Don't forget to references the DLL in your VB application!

Then you will be able to access your class from both application.

Author Comment

ID: 1521819
This is the simple solution. but I want to use many class in both the VB exe application and the ASP and some of the class are shared to some other vb applications and I don't want to create an ActiveX dll for each class (or group of classes).
LVL 70

Expert Comment

by:Éric Moreau
ID: 1521820
You can create one ActiveX that includes every classes that you have!
LVL 10

Accepted Solution

caraf_g earned 300 total points
ID: 1521821
A silly workaround, but it works.

You quite rightly point out that a class in an .exe has to be private, whereas in a DLL or anything else it can be public.

If you want to use the same class module both in a DLL and in an EXE (and you want to make it public in the DLL) you have a problem.

The best solution is to leave it private, and to write a public "wrapper" class around the private one:

Your public wrapper class

General declarations:
Private MyPrivateClassObject As YourPrivateClass

In Class_Initialize()
    Set MyPrivateClassObject = New YourPrivateClass

In Class_Terminate()
    Set MyPrivateClassObject = Nothing

And any property or method:
Public Property Get MyProperty() As SomeType
    MyProperty = MyPrivateClassObject.MyProperty


Public Sub DoSomething(SomeParameters As SomeTypes)
    MyPrivateClassObject.DoSomething SomeParameters


Clumsy, but it works.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

715 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