Set focus after clicking a button

  • Thread starter Sylvain Provencher
  • 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 ?
 
M

Matt Burland

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?
 
H

Herfried K. Wagner [MVP]

* "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>
 

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

Top