ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text Box Focus (https://www.excelbanter.com/excel-programming/304958-text-box-focus.html)

Tim Coddington

Text Box Focus
 
I have a bunch of option buttons and one text box on a form.
I want only the text box to have focus, so each time a user
clicks on an option button, the button is selected and focus
returns to TextBox1. I could go like ...

Private Sub OptionButton{1 of 20 numbers}_Click()
TextBox1.SetFocus
End Sub

But is there a way to make TextBox1 take focus automatically
so there is not so much repetition of 'TextBox1.SetFocus' in
my code? Perhaps there is a way to disable each option button
from ever getting focus when clicked (and still allow it to be
selected)?



Jim Cone

Text Box Focus
 
Tim,

One thing you could consider is set the focus to the TextBox in
the MouseMove event for the frame or the form.

Regards,
Jim Cone
San Francisco, CA

"Tim Coddington" wrote in message ...
I have a bunch of option buttons and one text box on a form.
I want only the text box to have focus, so each time a user
clicks on an option button, the button is selected and focus
returns to TextBox1. I could go like ...
Private Sub OptionButton{1 of 20 numbers}_Click()
TextBox1.SetFocus
End Sub
But is there a way to make TextBox1 take focus automatically
so there is not so much repetition of 'TextBox1.SetFocus' in
my code? Perhaps there is a way to disable each option button
from ever getting focus when clicked (and still allow it to be
selected)?




All times are GMT +1. The time now is 06:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com