How to use forms in a DLL?

Posted on 2011-10-25
Last Modified: 2012-05-12
I am developing an ActiveX DLL and I need to use forms in some functions, I don´t know if forms are used as same as a simple .exe application.

The idea is to open a form in which will be some buttons with their events handled.

Question by:dimensionav
    LVL 5

    Expert Comment

    Can you please tell me which version vb you are currently using?
    If you are using VB.Net then you can create form in library file and then add reference this file DLL file into you your project (where you want to open this form) . Add import statement by using same namespace that used in DLL project. Now the form class is available in your code your can create its object and then call its Show() method to show the form.


    Author Comment


    I am using VB6 SP6
    LVL 5

    Expert Comment

    If you are using VB6 then you can get form by its name after adding its reference. is it?
    LVL 16

    Accepted Solution

    You can create forms in a DLL just like you can in an exe.

    Simply start up a new ActiveXDLL project.  Where an exe would create a project with a single form, the ActiveXDLL will create a project with a single class.  But all you have to do is click on the "Project" menu, and you will see that you can "Add Form" as well as most other items (Class, User Control, Module, etc) to the project.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    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…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now