Results 1 to 2 of 2

Thread: How to set focus on text box and command button(focus the both the same event)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width