Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing a tab to the next control in an extended .net control

Say I'm extending a TextBox called CustomTextBox in .net. In certain situations I would like to force a tab to the next TabIndex on the form. Is there a way to do this beyond getting all the controls contained in CustomTextBox's parent, sorting them by their TabIndex, and then focusing the next ordinal one?

like image 720
EMaddox84 Avatar asked Nov 26 '08 18:11

EMaddox84


People also ask

How do I set tab order in Visual Studio?

To set the tab order, you simply select all three textboxes, then select Tab Order from the View menu. Then just click the controls in the order you want the tabs to sit. As you click each control, the tab order will be displayed on the control to keep you up to date.

How do I change the tab order in Winforms?

Tab order can be set in the Properties window of the designer using the TabIndex property. The TabIndex property of a control determines where it's positioned in the tab order. By default, the first control added to the designer has a TabIndex value of 0, the second has a TabIndex of 1, and so on.

What is tab stop access?

Use the TabStop property to specify whether you can use the Tab key to move the focus to a control.


1 Answers

I think you are looking for something like the following method:

form1.SelectNextControl(textBox1, true, true, true, true);

(All the trues are just different options, read the intellisense!)

You did say it is WinForms and not WebForms right?

like image 181
Zachary Yates Avatar answered Nov 10 '22 00:11

Zachary Yates