Set focus after clicking a button

  • Thread starter Thread starter Sylvain Provencher
  • Start date Start date
S

Sylvain Provencher

Hi everybody,

We have a surely common problem : I want to set focus on a TextBox control
after a user click on a button. If I put code like :

Private sub MyButton_Click(...) handle Mybutton.click
...Some stuff
MyTextBox.focus()
End Sub

The focus stay on the button. Same behavior in C#... A hint ?
 
Works fine for me (in C#)....perhaps it's something your doing in "Some
stuff"? Or do you have code that is supposed to be run when the textbox gets
focus?
 
* "Sylvain Provencher said:
We have a surely common problem : I want to set focus on a TextBox control
after a user click on a button. If I put code like :

Private sub MyButton_Click(...) handle Mybutton.click
...Some stuff
MyTextBox.focus()
End Sub

The focus stay on the button. Same behavior in C#... A hint ?

I am not able to repro that on Windows XP Professional + .NET 1.1.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Back
Top