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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:14:40+00:00 2026-05-12T11:14:40+00:00

In VB6 events created in an ActiveX component were stated like this: Public Event

  • 0

In VB6 events created in an ActiveX component were stated like this:

Public Event ProcessingComplete()

and called in that ActiveX component like:

RaiseEvent ProcessingComplete

I am creating a managed C++ DLL that I want to do the same thing with. It doesnt look like delegates are exactly what I want. I think the more appropriate item is an __event declaration. Help?!?

In the end, I have a C# application that I want to have a function like this:

MyObject::ProcessingComplete() <— This being the called function when “RaiseEvent” occurs.
{

}

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-12T11:14:40+00:00Added an answer on May 12, 2026 at 11:14 am

    It does sound like you want an event. In .NET, an event is just a delegate which by convention has a special signature. Here is a C# example of declaring an event in a class:

    public class MyObject
    {
        // ...
    
        public event EventHandler ProcessingComplete;
    
        // ...
    }
    

    EventHandler is a delegate with two parameters:

    public delegate EventHandler(object sender, EventArgs e);
    

    The sender is the object which raised the event and the EventArgs encode any information you want to pass to an event subscriber.

    Every event is expected to follow this convention. If you wish to communicate specialized information for your event, you can create your own class derived from EventArgs. .NET defines a generically typed EventHandler delegate for this purpose, EventHandler<TEventArgs>. C# example:

    class ProcessingCompleteEventArgs : EventArgs
    {
        public ProcessingCompleteEventArgs(int itemsProcessed)
        {
            this.ItemsProcessed = itemsProcessed;
        }
    
        public int ItemsProcessed
        {
            get;
            private set;
        }
    }
    
    // ...
    
    // event declaration would look like this:
    public event EventHandler<ProcessingCompleteEventArgs> ProcessingComplete;
    

    To subscribe to an event, use the += operator. To unsubscribe, use the -= operator.

    void Start()
    {
        this.o = new MyObject();
        this.o.ProcessingComplete += new EventHandler(this.OnProcessingComplete);
    
        // ...
    }
    
    void Stop()
    {
        this.o.ProcessingComplete -= new EventHandler(this.OnProcessingComplete);
    }
    
    void OnProcessingComplete(object sender, EventArgs e)
    {
        // ...
    }
    

    Inside your class, to fire the event, you can use the normal syntax to invoke a delegate:

    void Process()
    {
        // ...
    
        // processing is done, get ready to fire the event
        EventHandler processingComplete = this.ProcessingComplete;
    
        // an event with no subscribers is null, so always check!
        if (processingComplete != null)
        {
            processingComplete(this, EventArgs.Empty);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question: I need an event that fires every second, just like the timer1_timer()
How can i achieve event handling for dynamic controls in VB6? Any ideas?
In some VB6 code, I have a handler for a TreeView's Collapse event: Private
In VB6 you can do this: Dim a As Variant a = Array(1, 2,
In VB6, I was told that when testing for an empty string, it would
Handling events exposed on a .NET class via COM in VB6 My test .NET
I have existing managed and unmanaged software using an ActiveX component supplied by a
I have a WPF application implemented using the MVVM framework that uses an ActiveX
I created a multithreading C# COM-Assembly, I used it from VB6. The C#-COM can
I have an older VB6 project that I'm trying to add unit tests for.

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.