Keeping focus on a txtbox

T

Tim

I have txt1 on a form which should always get focus after any other
control is used. I have a spin button which I use to change the value
in txt2. When I click the spin button, if I use txt1.setfocus at the
end of the spinup and spindown events, txt1 only receives the focus
every second click. Why is this? The only way I have found to keep
the focus on txt1 is by placing the txt1.setfocus in the 'enter' event,
but then the spin button has no effect. How can I keep the focus on
txt1 and still allow the spin button to have an effect?
 
J

Jean-Yves

Hi Tim,

Give all other control the property "TabStop" to false for text boxes or
TakeFocusOnClick for button, etc to false
That way only your Text1 can get the focus
Regards
Jean-Yves
 
T

Tim

All controls have the tabstop set to false except Text1.
Thanks for the info on TakeFocusOnClick, but it doesn't help for a
spinner. I still have the same problem.

-Tim
 
Joined
Apr 6, 2006
Messages
40
Reaction score
1
see if the enabled property does anything for ya................
[form name].[control name].enabled = true/False....don't need the form name if code is in that form

Smithb2
 
Last edited:
J

Jean-Yves

Hi Tim,

Yes, just tried it ...
Then you have to give focus to the textbox by code at the end of you spinner
code
Regards
JY
 
T

Tim

I already do. Tried one other thing; a breakpoint on the .setfocus to
see if the event was actually occuring. It was. The extra pause given
by stopping at the breakpoint allowed the system to work as expected.
But when I remove the breakpoint, the same problem is back. Any more
ideas?
 

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