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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:25:49+00:00 2026-05-20T21:25:49+00:00

Correct me if i’m wrong, but i believe most (if not all) classes in

  • 0

Correct me if i’m wrong, but i believe most (if not all) classes in the CLR that raise events raise those events from protected methods, for example Form.OnMouseDown… so…

In a subclass, when would you want to override the “OnXyzMethod” instead of simple adding an event handler like Visual Studio does by default when you want to handle a controls event?

The only thing that occurs to me is that I might want to override the method to prevent the event from actually being raised… not that i can think of when that might apply…

  • 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-20T21:25:50+00:00Added an answer on May 20, 2026 at 9:25 pm

    The OnEvent method is provided in order to raise the event. This method is usually virtual so that you may change how and when the event is raised in a derived class. You should only override this method if you’re changing either of those things.

    If, for example, it wasn’t appropriate to raise the event in a subclass under certain conditions (e.g. an object that is a disabled state), you could override the default OnEvent behaviour to prevent the event being raised.

    You should not override the OnEvent method to add behaviour in response to the event occuring; that’s the purpose of event handlers.

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

Sidebar

Related Questions

Correct me if Im wrong. Not all operators implement the feature that lets you
Correct me if I'm wrong, but a build is a compile, and not every
Please correct me if I'm wrong, but I believe the Web DB is domain
Please correct me if I'm wrong, but I'm thinking of all of my non-AJAX
Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific
Correct me if I'm wrong, but it seems like algebraic data types in Haskell
Correct me if I'm wrong, but Server studio doesn't have relationship connectors. Is there
Correct me if I'm wrong, but I'm surprised this hasn't been asked before on
Correct me if I'm wrong, is YARD not the same as RDoc ? It's
correct me if i'm wrong, but Adobe AIR currently only allows applications to have

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.