Setting focus to a textbox in a tabcontrol

  • Thread starter Thread starter M O J O
  • Start date Start date
M

M O J O

Hi,

Maybe this question has been asked before, but I've searched the net
without finding any answer.

I create a new solution, put a TabControl on Form1, create a TabPage and
a put a TextBox in this TabPage.

I run the project and the TextBox does not have focus. :o(

I try this...

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
Me.TextBox1.Focus()
End Sub

This does not give the TextBox focus either.

I check the tab order and this is correct.

How do I set focus to a TextBox in a TabControl???

Thanks!!!

M O J O
 
It works for me in the Activated event

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Mojo,

Works for me as well, the same as with Terry

So there should be something more I think.

Cor
 
* M O J O said:
I run the project and the TextBox does not have focus. :o(

I try this...

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated

Me.TextBox1.Focus()
End Sub

This does not give the TextBox focus either.

I check the tab order and this is correct.

Make sure the control is visible and enabled. If the control has the
lowest 'TabIndex' on the form, then it will be focussed automatically.
 
Back
Top