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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:58:08+00:00 2026-05-29T23:58:08+00:00

I need to raise an event from a form on a new thread. (I

  • 0

I need to raise an event from a form on a new thread.

(I don’t believe the reason for this is relevant, but just in case: I’ll be raising events from code within a form’s WndProc sub. If the code handling the event blocks with something on a form [such as a msgbox], then all sorts of trouble occurs with disconnected contexts and what not. I’ve confirmed that raising events on new threads fixing the problem.)

This is what I am currently doing:

Public Event MyEvent()

Public Sub RaiseMyEvent()
    RaiseEvent MyEvent
End Sub

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    Dim t As New Threading.Thread(AddressOf RaiseMyEvent)
    t.Start()
End Sub

Is there a better way?

It is my understanding that events in VB are actually made up of delegates in the background. Is there any way to raise events in new threads without creating subs for each? Or, is there a more appropriate method I should be using?

  • 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-29T23:58:12+00:00Added an answer on May 29, 2026 at 11:58 pm

    You can eliminate the RaiseMyEvent sub like this:

    Public Class Class1
    
        Public Event MyEvent()
    
        Sub Demo()
            Dim t As New Threading.Thread(Sub() RaiseEvent MyEvent())
            t.Start()
        End Sub
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a custom control and need to raise an event from
I want to raise an event from a .NET class, and receive this event
I need raise an exception from C++ code. Raised exception must contain text and
I don't understand why we need the event keyword while defining events, when we
Is there a way to raise an event in C# from an external application?
I'm sure I've seen this around before but I'm wondering how I should raise
Maybe I'm slow, but I just don't get why you would ever use an
I need to raise a couple of events with parameters within a jquery plugin,
i need to identify who raise an exception to handle better str error, is
I need to be able to raise different types of audio notifications to the

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.