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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:11:57+00:00 2026-05-14T02:11:57+00:00

imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3×3 tile,

  • 0

imagine that I have a Form with 9 controls (TabbedStuffControl) in a 3×3 tile, and these controls contain TabControls containing another control (StuffControl) with ListBoxes and TextBoxes.

I’d like to know a proper way to let TabbedStuffControl that its child has received a focus? e.g. user clicks into a textbox of StuffControl or drags something to listbox of StuffControl. Eventually the Form should know which TabbedStuffControl is active

Do I need to hook up GotFocus event of TextBoxes and ListBoxes and TabControls, then dispatch another event to finally let Form know who got focus? I think that there should be a simpler way – that somehow TabbedStuffControl knows that its child got focus, so there would be only one place in code that I’ll hook up.

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-14T02:11:57+00:00Added an answer on May 14, 2026 at 2:11 am

    Using the Enter event (better then GotFocus) is certainly a good approach. Subscribe a handler for all controls, then go find the parent of the control in the Enter event handler. This sample code demonstrates the approach:

      public partial class Form1 : Form {
        public Form1() {
          InitializeComponent();
          wireEnter(this.Controls);
        }
        private void wireEnter(Control.ControlCollection ctls) {
          // Hook Enter event for all controls
          foreach (Control ctl in ctls) {
            ctl.Enter += ctl_Enter;
            wireEnter(ctl.Controls);
          }
        }
    
        TabbedStuffControl mParent;
    
        private void ctl_Enter(object sender, EventArgs e) {
          // Find parent
          Control parent = (sender as Control).Parent;
          while (parent != null && !(parent is TabbedStuffControl)) parent = parent.Parent;
          if (parent != mParent) {
            // Parent changed, do something.  Watch out for null
            //....
            mParent = parent as TabbedStuffControl;
          }
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine I have the coordinate of 4 points that form a polygon. These points
Imagine that I had a form where I wanted to have a rent date
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx.
Imagine that you have several links on a page. When you clicked, a div
Is it normal to modify setter arguments? Let's imagine that we have setString method.
Imagine I have a process that starts several child processes. The parent needs to
Imagine I have the following: inFile = /adda/adas/sdas/hello.txt # that instruction give me hello.txt
Imagine this case where I have an object that I need to check a
There is one thing that I do not understand... Imagine you have a text
Let's imagine that we have privacy options page in social network; two group of

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.