473,473 Members | 4,185 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Don't Tab to next box on enter

14 New Member
I am trying to find out how to retain focus on a button if you use enter to activate a click event on the button. When you hit the enter key, the focus should stay on the button until you hit tab, but presently, it jumps to the next button.
I would post some of my code, but none of my attempts even came close to working, so I am at a loss as to were to even begin. It is probably some simple two-line piece of code that I am unaware of . . . .
May 5 '09 #1
3 1078
tlhintoq
3,525 Recognized Expert Specialist
in the button.click event handler do everything you need to handle then finish with

((Button)sender).Focus();
May 5 '09 #2
desertavataraz
14 New Member
That worked. . . . and from a fellow Arizonian, at that!
I tried ((btnFind)sender).Focus(); but it did not like the
paranthesis or the semicolon, so I just did btnFind.focus and it
worked like a charm! Thanks again.
May 5 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
but it did not like the
paranthesis or the semicolon
Sorry... I didn't see that the original post was VB. I gave you C#, but you seemed to have translated it just fine. Cool.
May 5 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
6
by: Terry | last post by:
I have a form which is displayed in Datasheet View and would prefer it if, when entering data, I could use the keyboard as I would when entering data into a Datasheet. Is it possible when...
4
by: Vincent Yang | last post by:
I'm using Access 2002. My database is in Access 2000 format. I'm designing a form to collect responses to a 40-item questionnaire. I can fit four list boxes on a screen, so I plan to have 11 tab...
1
by: chrissmith_76_Fed_Up_With_Spam | last post by:
Hello all, I am using Access 2002, with file format of Access 2000, and am experiencing a problem. I have a subform that is shown in datasheet view for users to edit data direct to a table. ...
0
by: Tom Edelbrok | last post by:
To all: I am new to Visual Studio 2005 (VB.NET) and am writing my first web application. I see that controls, when double-clicked at design time, show you code for events that fire. In fact this...
5
by: BLACKDOG157 | last post by:
I've made a form with a variable number of textboxes. The user fills them out, and then I need to pick up the values he has filled in. The number of textboxes vary depending on a value that the...
24
by: MichaelK | last post by:
Who knows how to prevent submitting a form on the press Enter button before all fields on the form are filled up. People just enter the first field hit Enter and it submits the form and doing...
2
by: srini4vasan | last post by:
#include <stdio.h> int main() { char n, m; puts (" Enter the first string and . to terminate :"); do { n = getchar(); putchar(n);
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.