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?
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.
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.
Use the TabStop property to specify whether you can use the Tab key to move the focus to a control.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With