strange error with focus?

  • Thread starter Thread starter perspolis
  • Start date Start date
P

perspolis

Hi all
I have TabControl that hosts some TextBox.
I want to give focus to textBox1 when my form loads..
I use textBox1.Focus() but it dosen't work..
???
 
perspolis said:
Hi all
I have TabControl that hosts some TextBox.
I want to give focus to textBox1 when my form loads..
I use textBox1.Focus() but it dosen't work..
???
Are you sure your text box is enabled at the time of setting focus?
 
You have to first select the TabPage that hosts the TextBox, then do
TextBox.Focus... otherwise it won't work.
 
Hi all
I have TabControl that hosts some TextBox.
I want to give focus to textBox1 when my form loads..
I use textBox1.Focus() but it dosen't work..
???
Try selecting the right tab first:
myTabControl.SelectedIndex = 1;
once the right page is visible you should be able to focus on your
text box.

rossum
 
Back
Top