I have a form with 2 buttons and 2 labels.
I want to set button 1 = tabIndex = 0, button 2 = tabIndex = 1 and I do not want to set a tabIndex to the 2 labels, meaning that if the user presses tab, it'll go from button 1 to button 2.
How would I go about doing this?
Solution with the tabindex attribute To prevent tab indexing on specific elements, you can use tabindex="-1". If the value is negative, the user agent will set the tabindex focus flag of the element, but the element should not be reachable with sequential focus navigation.
The following example uses the TabIndex property to display and set the tab order for individual controls. You can press Tab to reach the next control in the tab order and to display the TabIndex of that control. You can also click on a control to display its TabIndex.
For example, you can set the TabStop property of a command button to No to prevent users from selecting the button by pressing Tab. However, they can still click the command button to choose it.
Just set the TabStop property of the Labels to false and the TabIndex property of the Buttons to whatever you want. You can do it right in the Properties window of the designer.
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