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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top