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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:27:04+00:00 2026-05-31T22:27:04+00:00

I have a user control that behaves as a floating control, and I would

  • 0

I have a user control that behaves as a floating control, and I would like to restrict the tab order only to my user control when its visible. Basically what I need is to have a control that behaves like a borderless Form. Actually it was a Form, but I needed to preserve the Focus in the MainForm window, so I had to change it to be a UserControl.

So, imagine a Form A (MainForm), and my UserControl B. B is a child control of A. Suppose that Form A has a button and a TextBox, and the control B also has a button and a Textbox. The secuence that currenly occurs is the following

What currently happens (natural tab order behavior):

When only A is visible (B is not visible):

1. The user manually focuses A textbox
2. Press tab key
3. A button is focused

When A is visible and also B is visible: (the natural tab order key is the following):

1. The user manually focuses B textbox
2. Press tab key
3. B button is focused
4. Press tab key
5. A textbox is focused
6. Press tab key
7. A button is focused

What I need (I need to change my user control to preserve the focus):

What I really need is that the B control preserves the tab order inside it, so what I need is with when B control is visible:

1. The user manually focuses B texbox
2. Press tab key
3. B button is focused
4. Press tab key
5. B textbox is focused
  • 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-31T22:27:05+00:00Added an answer on May 31, 2026 at 10:27 pm

    Finally I solved the issue including the following code in the parent control:

        private int WM_KEYDOWN = 0x100;
    
        public override bool PreProcessMessage(ref Message msg)
        {
            Keys key = (Keys)msg.WParam.ToInt32();
    
            if (msg.Msg == WM_KEYDOWN && key == Keys.Tab)
            {
                if (itemSearchControl.Visible)
                {
                    bool moveForward = !IsShiftKeyPressed();
                    bool result = itemSearchControl.SelectNextControl(itemSearchControl.ActiveControl, true, true, true, true);
                    return true;
                }
            }
    
            return base.PreProcessMessage(ref msg);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control that is pretty basic. It contains several TextBox controls,
I have a user control that I'm building. It's purpose is to display the
i have a user control that descends from UserControl. When dropped onto the form
I have a user control that has a few public properties, one is an
I have a user control that I've created, however when I go to add
I have a user control that takes a several seconds to load. Is there
I have a user control that contains a collection of controls to be reused
I have a user control that contains a GridView. The GridView has both a
I currently have a user control that is used on both an /Address/Edit and
I want to have a User Control that takes a collection of People (property

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.