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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:37:22+00:00 2026-05-10T17:37:22+00:00

Is there any way for the main form to be able to intercept events

  • 0

Is there any way for the main form to be able to intercept events firing on a subcontrol on a user control?

I’ve got a custom user-control embedded in the main Form of my application. The control contains various subcontrols that manipulate data, which itself is displayed by other controls on the main form. What I’d like is if the main form could be somehow informed when the user changes subcontrols, so I could update the data and the corresponding display elsewhere.

Right now, I am cheating. I have a delegate hooked up to the focus-leaving event of the subcontrols. This delegate changes a property of the user-control I’m not using elsewhere (in this cause, CausesValidation). I then have a delegate defined on the main form for when the CausesValidation property of the user control changes, which then directs the app to update the data and display.

A problem arises because I also have a delegate set up for when focus leaves the user-control, because I need to validate the fields in the user-control before I can allow the user to do anything else. However, if the user is just switching between subcontrols, I don’t want to validate, because they might not be done editing.

Basically, I want the data to update when the user switches subcontrols OR leaves the user control, but not validate. When the user leaves the control, I want to update AND validate. Right now, leaving the user-control causes validation to fire twice.

  • 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. 2026-05-10T17:37:23+00:00Added an answer on May 10, 2026 at 5:37 pm

    The best practice would be to expose events on the UserControl that bubble the events up to the parent form. I have gone ahead and put together an example for you. Here is a description of what this example provides.

    • UserControl1
    • Create a UserControl with TextBox1
    • Register a public event on the UserControl called ControlChanged
    • Within the UserControl register an event handler for the TextBox1 TextChangedEvent
    • Within the TextChangeEvent handler function I call the ControlChanged event to bubble to the parent form
    • Form1
    • Drop an instance of UserControl1 on the designer
    • Register an event handler on UserControl1 for MouseLeave and for ControlChanged

    Here is a screenshot illustrating that the ControlChanged event that I defined on the UserControl is available through the UX in Visual Studio on the parent Windows form.

    Event Handlers for User Control

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer It's called a 'covering index', and it improves the efficiency… May 11, 2026 at 10:06 am
  • added an answer Here is my 2 cents: Type genericType = typeof(Repository<>); Type[]… May 11, 2026 at 10:06 am
  • added an answer Well, I can share a story: Long long time ago,… May 11, 2026 at 10:06 am

Related Questions

Is there any way for the main form to be able to intercept events
Is there any way for a DBA to peek in on the execution plan
Is there any way for developer to send data to the iPhone's USB port?
Is there any way to view the activity log for the integrate SourceSafe inside
Regardless of the layout being used for the tiles, is there any good way
Is there any way to create the query parameters for doing a GET request
Is there any way to change the ownership and permission mask for a semaphore
Is there any way to increase the heap size for Java ME on a
Is there any way to have the QCompleter to act like an autocomplete for
Is there any way to do this in the Powerbuilder properties window for a

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.