Mar 21st, 2008, 03:20 AM
How to set focus on text box and command button(focus the both the same event)
Hi all, I am using vb.net coding. I want to set focus on text box to type in text box and focus on command button in the same time.
For example, I have one text box and one command button.
when my form running i want to send cursor to text box to input data and i want to set focus on command button at the same moment(focus on text box and command button). It means when i am typing in text box another command button is focus as well. How can we do like this? please help me.
thank so much.
Mar 21st, 2008, 05:45 AM
Re: How to set focus on text box and command button(focus the both the same event)
It's not possible. Only one control can have focus at a time.
Why exactly do you want to do this? Is it so you can just press Enter to "press" the Button when you're done typing? If so then just assign the Button to the form's AcceptButton property. That way that Button will respond as though clicked whenever you press Enter and the control with focus doesn't itself respond to that key.
Click Here to Expand Forum to Full Width