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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:10:11+00:00 2026-05-13T06:10:11+00:00

I have a VB6 project(windows application) and I have to redevelop a module in

  • 0

I have a VB6 project(windows application) and I have to redevelop a module in the existing VB6 project in C#.net.

The module that I develop in C#.net should be a dll and should contain some windows forms. I was able to successfully call a c# console applicaiton dll from my vb6 project but I am facing issues when i try to call a C# class library with winforms from my VB6 project.

This is what I have done for my Proof Of Concept – This is a class file in my C#.net class library project.

namespace TestDll
{
    public interface IClass1
    {
        void DisplayMessage();
    }


    public class Class1:IClass1
    {              
        void IClass1.DisplayMessage()
        { 
            MessageBox.Show ("Displyaing message");
        }

    }
}

I have a form in the same nemspace and I plan to instantiate Class1 and use its object on the page_load event of the C# winform.

In my VB6 project I want to display the form I have in my C#.net dll. I am calling it by this code –

Private Declare Sub DislayMessage Lib "TestDll.dll" ()

Private Sub Command1_Click() //On button click event of the VB6 windows form
DislayMessage
End Sub

I get an error – “Can’t find a DLL entry point in DisplayMessage in TestDll.dll”

I am not sure how to solve this error. I am even skeptical if this is the way a C#.net dll which contains some winforms should be called from a VB6.0 windows applicaiton.

Should I instantiate Class1 in my VB6 code? How do I resolve this error?
Is my approach correct? Are there better ways to do this?

TIA.

  • 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-13T06:10:11+00:00Added an answer on May 13, 2026 at 6:10 am

    You have to make your class COM-Visible. Here’s how I would change your code:

    namespace TestDll
    {
        [Guid("FB8AB9B9-6986-4130-BD74-4439776D1A3D")]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        [ComVisible(true)]
        public interface IClass1
        {
            [DispId(50)]
            void DisplayMessage();
        }
    
    
       [Guid("74201338-6927-421d-A095-3BE4FD1EF0B4")]
       [ClassInterface(ClassInterfaceType.None)]
       [ComVisible(true)]
       [ProgId("TestDll.Class1")]
        public class Class1:IClass1
        {              
            void IClass1.DisplayMessage()
            { 
                MessageBox.Show ("Displyaing message");
            }
    
        }
    }
    

    Note the [DispId(50)]. You want to specify the dispatch ID for your COM-visible methods, properties, and events. If you don’t, the compiler will do it for you and you may end up breaking compatibility every time you compile. The number doesn’t matter so much as it doesn’t change between compiles.

    You might want to check out Building COM Objects in C#. It’s a pretty good getting started tutorial.

    Some highlights:

    Exposing the VC# objects to the COM
    world requires the following …

    * The class must be public
    * Properties, methods, and events must be public.
    * Properties and methods must be declared on the class interface.
    * Events must be declared in the event interface.
    

    Every Interface needs a GUID property
    set before the interface name. To
    generate the unique Guid , use the
    guidgen.exe utility and select the
    Registry Format.

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

Sidebar

Ask A Question

Stats

  • Questions 296k
  • Answers 296k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's not possible... but it can be faked with inheritance… May 13, 2026 at 7:05 pm
  • Editorial Team
    Editorial Team added an answer You would most likely need for them to call your… May 13, 2026 at 7:05 pm
  • Editorial Team
    Editorial Team added an answer Looks like the code changed from version 2.2 to version… May 13, 2026 at 7:05 pm

Related Questions

I have a VB6 application that needs to be installed on Windows Vista as
I have a WinForms application written in C# for .NET 3.5 that needs to
I'm working on porting a large vb6 application to .NET. The current app is
FYI - I am a mainframer that moved to the .NET world a couple
Platform: Windows XP Development Platform: VB6 When trying to set an application title via

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.