Hi, i'm trying to focus the cursor on a textbox inside one of my tab controls (3 tabs) but my method doesn't seem to work...Any ideas?
Here is my code:

private void Maintenance_Load(object sender, EventArgs e)
            tabControl1.SelectedIndex = 0;


I ran the same code and it focuses fine.
You dont need to call


since you then move focus to the textbox.
When you set the SelectedIndex for the tabControl are you selecting the tab page which contains the textbox?

The other thing to do is check that nothing is calling focus away from the textbox after you set focus to it.

Hello, phoenix_dwarf.

While playing with your code found interesting thingy: it works fine on every tab .. except the 1st one. Anyway, while trying to explain such behaviour, found this:

Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.

So, this should work fine:

tabControl1.SelectedIndex = 0;
commented: nice catch, i learnt something too here :p +1

Tnx Antenka...it works. I'm just puzzled by why my original code doesn't want to work...? l0olâ„¢ Ahw well, thnx again!