Change TabIndex

1

How do I get the TabIndex from a Form to a given position?

I tried using this.ActiveControl.TabIndex = 0; , but it did not work.

    
asked by anonymous 16.08.2017 / 14:27

1 answer

0

This is not possible. In fact, in the way you are doing, you are trying to change the TabIndex of the active control, and you need to change the currently active control .

What you can do is set the ActiveControl property of the Form.

For example:

this.ActiveControl = this.textBoxBusca;

If you want to very select the control by your TabIndex, you work with LINQ for this. For the record, I find this approach extremely unnecessary.

var controle = this.Controls.First(c => c.TabIndex == 0);
this.ActiveControl = controle;
    
16.08.2017 / 14:54