Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Setting form controls focus and enter key

I have a form set up for entering names into my application. On this setup
form I have a

textbox ="NameEntry and a
Listbox = "RepList"
Button1 = "add"
Button2 = "remove"

The users procedure is:

1) Enter name into text box
2) click on the add button

The name is tranfered to the listbox for viewing and the "textbox" is
cleared, but the add button remains in focus

How can I return focus to the textbox? i.e. place the cursor back into the
text box.
Is it possible to set the "enter" key to click the add button instead of
have to actually click it with the mouse?

A KeyPress event does not occur under the following conditions:

a.. Pressing TAB.
b.. Pressing ENTER.
c.. Pressing an arrow key.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting form controls focus and enter key

You can set the Default property of the add button to True. Only one
control on the form can have the default property set to true. If enter is
hit, then the click event for that control is fired.

Have you tried using the setfocus method of the control?

--
Regards,
Tom Ogilvy


"John T Ingato" wrote in message
...
I have a form set up for entering names into my application. On this

setup
form I have a

textbox ="NameEntry and a
Listbox = "RepList"
Button1 = "add"
Button2 = "remove"

The users procedure is:

1) Enter name into text box
2) click on the add button

The name is tranfered to the listbox for viewing and the "textbox" is
cleared, but the add button remains in focus

How can I return focus to the textbox? i.e. place the cursor back into

the
text box.
Is it possible to set the "enter" key to click the add button instead of
have to actually click it with the mouse?

A KeyPress event does not occur under the following conditions:

a.. Pressing TAB.
b.. Pressing ENTER.
c.. Pressing an arrow key.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form keep the focus unable to get to the code - HELP! Kaz G New Users to Excel 1 January 23rd 08 06:00 PM
Setting the focus Orf Bartrop New Users to Excel 4 August 9th 06 05:36 AM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
must press enter 2x to move cell focus Lynn Excel Discussion (Misc queries) 0 March 18th 05 06:05 PM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM


All times are GMT +1. The time now is 09:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"