Controlling tab key in groupboxes


Our application is .NEt 2.0 c# Winforms

I would like to know if there's a mean to control the behavior of the tab key in a usercontrol.  In majority of cases it's easy when using TabIndex and TabStop property.

A request has been made to modify the tab  order of one of usercontrol. The problem is taht the tab order requested is jumping from a control in a groupbox to another to come back to the previous group box.

Removing groupbox is not an option. Changing controls order to fit is not an option too, because some customers want the behavior and others not.

For example, in a user control we have GroupBoxA with control A and B. We have another groupbox B with control C and E.

Tab key should move from control A to C to B to E. As far as i know, this is not possible to achieve in a "normal" tab index feature because GroupBox have their tab index and the controls within it are "child" of the tab index.

What can I do to solve this?

Let me know if my question is unclear or for additional information.

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
I don't think you can either. (Sorry for the very unhelpful response)
Bob LearnedCommented:
I haven't done Windows Forms forms in a while, but there was a way to handle custom tab order by intercepting the WM_KEYDOWN message in the form's ProcessCmdKey, and defining your own custom tab order, so that the system would know which control to set focus to.
If you do not need the GroupBoxes from the programaticall object model point of view, and they have to be there only for the visual apperance, then create the TextBoxes as not being the children objects of the aforementioned GroupBoxes, but they will be only the children of the parent Form/Panel/.../object where the GroupBoxes are within, but they will be displayed in front of them (to achieve this mos simply, move the text boxes USING THE MOUSE OUT of the group boxes and then move them back OVER the GROUP BOXES using the ARROW KEYS). Should they disappear, right click the GroupBox that has hidden them/it and select "Send to back".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.