T
Tim
I have a form with 2 controls; TextBox1 and SpinButton1. I want only
TextBox1 to ever have focus, and for SpinButton1 to do a small job,
then give focus back to TextBox1. The code I have written is as
follows:
Option Explicit
Private Sub SpinButton1_SpinDown()
TextBox1.SetFocus
End Sub
Private Sub SpinButton1_SpinUp()
TextBox1.SetFocus
End Sub
When I click SpinButton1, focus is sent to TextBox1 only every other
time; not every time. However, when I put a breakpoint on
TextBox1.SetFocus (so I have to click the 'run' arrow each time), focus
is returned to TextBox1 each time as it should be. Although tabstop
does not affect this effect, I do have it set to false. Setting
TakeFocusOnClick to false isn't a help, because a spin button doesn't
have that property, so I can't set it at all. I have placed a
'doevents' statement in each Sub, but that didn't help (Perhaps I
didn't do it correctly?).
How can I get it to return focus after each click to TextBox1?
TextBox1 to ever have focus, and for SpinButton1 to do a small job,
then give focus back to TextBox1. The code I have written is as
follows:
Option Explicit
Private Sub SpinButton1_SpinDown()
TextBox1.SetFocus
End Sub
Private Sub SpinButton1_SpinUp()
TextBox1.SetFocus
End Sub
When I click SpinButton1, focus is sent to TextBox1 only every other
time; not every time. However, when I put a breakpoint on
TextBox1.SetFocus (so I have to click the 'run' arrow each time), focus
is returned to TextBox1 each time as it should be. Although tabstop
does not affect this effect, I do have it set to false. Setting
TakeFocusOnClick to false isn't a help, because a spin button doesn't
have that property, so I can't set it at all. I have placed a
'doevents' statement in each Sub, but that didn't help (Perhaps I
didn't do it correctly?).
How can I get it to return focus after each click to TextBox1?