473,382 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Enter Key behavior

I have a data entry application. Due to ease and location, the users
utilizie the enter key to move from field to field, rather than the tab key.
Depending on the data they enter into a field, they may skip fields in the
"tab order" so I do not simply use process tab key. Application works fine
except for an oddity. There is a button on the form. If the user hits enter
to arrive on the button, then swaps (via MDI) to another form, (using
shortcut keys, not mouse) then uses another shortcut key to go back to first
form, even though you set focus to another control on the form, the enter key
will not leave the button. Subsequent use of the enter key is disabled until
you close the form and reopen it. Is there any workaround for this?

Mar 2 '07 #1
8 5068
Lisa,

The best workaround is to help your clients to make them use to the tab key
telling that they give them self a disadvantage by not doing that. By
instance they get errors by every new employee they hire.

It is something the same as people who want still the steering wheel on the
back sit, just because they are used by it.
Cor

"LisaConsult" <li**********@online.nospamschreef in bericht
news:D2**********************************@microsof t.com...
>I have a data entry application. Due to ease and location, the users
utilizie the enter key to move from field to field, rather than the tab
key.
Depending on the data they enter into a field, they may skip fields in the
"tab order" so I do not simply use process tab key. Application works
fine
except for an oddity. There is a button on the form. If the user hits
enter
to arrive on the button, then swaps (via MDI) to another form, (using
shortcut keys, not mouse) then uses another shortcut key to go back to
first
form, even though you set focus to another control on the form, the enter
key
will not leave the button. Subsequent use of the enter key is disabled
until
you close the form and reopen it. Is there any workaround for this?

Mar 2 '07 #2
Hi Lisa,

Based on my understanding, you have a WinForm application which contains an
MDI parent and several MDI child forms. On one MDI child form, there're
several TextBox and a Button. The users could press the Enter key to
navigate through the TextBox on the MDI child form. The problem is that
when the focus is on the button, and the user press Ctrl+Tab to switch to
another MDI child form, and then switch back to the previous MDI child
form, the Enter key won't work for navigation any more. If I'm off base,
please feel free to let me know.

I performed a test based on your description, but didn't reproduce the
problem on my side.

The following is the code to navigate through the TextBox controls on the
MDI child form in my test.

public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.textBox1.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox2.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox3.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox4.KeyUp += new KeyEventHandler(control_KeyUp);
this.button1.KeyUp += new KeyEventHandler(control_KeyUp);
}

void control_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.SelectNextControl(sender as Control, true, true,
false, true);
}
}
}

Is there any difference between your project and mine? If the problem is
still not solved, you may send me a sample project that could just
reproduce the problem. To get my actual email address, remove 'online' from
my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 2 '07 #3
Linda,
Thank you for your response. Your synopsis is correct, except that the user
actually uses a hot key which causes the move from screen to screen (not
Ctrl+Tab). The user enters text in Text1,Text2 and Text3 on Screen A, hit
enter and focus is on the button. Then they need to switch to screen B and
add a record. So, the user hits the hotkey (Ctrl+M) on MDI Parent. Screen A
is saved, control toggles to screen B, prepares for an insert and gives the
user control. User completes entry in screen B, then uses a hot key (Ctrl+A)
to toggle back to screen A. So user hits the hotkey, screen B is saved,
control toggles back to screen A, prepares for an insert and places the
cursor in Text1. You can see the blinking focus in Text1. Then user enters
value in text1 hits enter to go to Text2, but the control is actually at the
button. If the user attempts to use the mouse to move to Textbox2, they can,
but anytime enter is hit after that, enter is always designated as the
button. It's like somehow, in this sequence, the form decides to assume that
the button is set as the default Accept Button. If you leave the screen and
get back in, everything works fine. Please note that if a mouse is used in
the process, if the user doesn't move from screen to screen or if they use
the hotkey to insert a record on screen A, but don't move screens, the error
doesn't occur. We've checked code , but we've also seen (in this group) that
others have seen this problem as well, so we are wondering if there is a
workaround.

"Linda Liu [MSFT]" wrote:
Hi Lisa,

Based on my understanding, you have a WinForm application which contains an
MDI parent and several MDI child forms. On one MDI child form, there're
several TextBox and a Button. The users could press the Enter key to
navigate through the TextBox on the MDI child form. The problem is that
when the focus is on the button, and the user press Ctrl+Tab to switch to
another MDI child form, and then switch back to the previous MDI child
form, the Enter key won't work for navigation any more. If I'm off base,
please feel free to let me know.

I performed a test based on your description, but didn't reproduce the
problem on my side.

The following is the code to navigate through the TextBox controls on the
MDI child form in my test.

public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.textBox1.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox2.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox3.KeyUp += new KeyEventHandler(control_KeyUp);
this.textBox4.KeyUp += new KeyEventHandler(control_KeyUp);
this.button1.KeyUp += new KeyEventHandler(control_KeyUp);
}

void control_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.SelectNextControl(sender as Control, true, true,
false, true);
}
}
}

Is there any difference between your project and mine? If the problem is
still not solved, you may send me a sample project that could just
reproduce the problem. To get my actual email address, remove 'online' from
my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 2 '07 #4
Cor,
Although your suggestion may seem logical to us, dataentry users who have
heavy number keypad use do not find the tab key to be practical for fast
entry. The loss in productivity is high. The app is a re-write and the
users could do it in VB6, so this is also causing huge questions about why we
are spending money for a rewrite when it's inefficient in user productivity.
We need a workaround that allows them to use the enter key. Thanks

"Cor Ligthert [MVP]" wrote:
Lisa,

The best workaround is to help your clients to make them use to the tab key
telling that they give them self a disadvantage by not doing that. By
instance they get errors by every new employee they hire.

It is something the same as people who want still the steering wheel on the
back sit, just because they are used by it.
Cor

"LisaConsult" <li**********@online.nospamschreef in bericht
news:D2**********************************@microsof t.com...
I have a data entry application. Due to ease and location, the users
utilizie the enter key to move from field to field, rather than the tab
key.
Depending on the data they enter into a field, they may skip fields in the
"tab order" so I do not simply use process tab key. Application works
fine
except for an oddity. There is a button on the form. If the user hits
enter
to arrive on the button, then swaps (via MDI) to another form, (using
shortcut keys, not mouse) then uses another shortcut key to go back to
first
form, even though you set focus to another control on the form, the enter
key
will not leave the button. Subsequent use of the enter key is disabled
until
you close the form and reopen it. Is there any workaround for this?


Mar 2 '07 #5
One additional note. When I return to Screen A, the focus of Text1 and the
button are both true even though I set focus to Text1. If I set
Button.enabled = False then the enter key does nothing on the form.
Form.Acceptbutton and Form.Cancelbutton are both nothing.

Mar 2 '07 #6
LisaConsult wrote:
I have a data entry application. Due to ease and location, the users
utilizie the enter key to move from field to field, rather than the tab key.
Depending on the data they enter into a field, they may skip fields in the
"tab order" so I do not simply use process tab key. Application works fine
except for an oddity. There is a button on the form. If the user hits enter
to arrive on the button, then swaps (via MDI) to another form, (using
shortcut keys, not mouse) then uses another shortcut key to go back to first
form, even though you set focus to another control on the form, the enter key
will not leave the button. Subsequent use of the enter key is disabled until
you close the form and reopen it. Is there any workaround for this?
Using VB 2005, I have experienced similar to you in the past and, as
strange as it may seem, discovered it was caused by a ToolStrip Control,
although mine was in relation to switching between Tabs on a TabControl,
not MDI forms. Are you using a ToolStrip Control on your Parent Form?
Is so, you may find this is where your problem comes from as it is
capturing the keystrokes when you return to your MDI form, even though
the focus appears to be with the button.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Mar 2 '07 #7
Hi Lisa,

Thank you for your prompt response and detailed explanation.

You have mentioned Screen A and B in your reply. Does the machine has two
monitors?

When the user presses Ctrl+M to switch to Screen B and add a record, is he
using another program, i.e. not the MDI program on Screen A?

I suggest that you set a break point in the KeyDown/KeyUp event handler in
the data entry form and press F5 to start the problem. After you switch to
Screen B and then switch back to Screen A, press the Enter key and debug
your program to see how the KeyDown/KeyUp event handler is executed.

Since the problem doesn't exist unless you switch to Screen B, I suspect
that the problem may be related to the driver of the display card on your
machine. If possible, you may have a try changing the hot key to switch
Screens to see if the problem still exists. You may also have a try
upgrading the driver of the display card, if any.

Hope this helps.
Sincerely,
Linda Liu
Microsoft Online Community Support

Mar 6 '07 #8
Hi Lisa,

How about the problem?

If you need our further assistance, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Mar 8 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
10
by: Deano | last post by:
I think that just about sums it up. Is there a fix/workaround for this?It's quite annoying behaviour and not user-friendly.thanksMartin
2
by: MJC | last post by:
Hi All, I just built a database in Access XP/Win XP and am having an issue with the enter key behavior when the database is run under Windows 2000. If you use the enter key to tab through the...
7
by: deko | last post by:
I have a textbox in a form into which users enter a string to execute a search. After the user presses Enter, I'd like the focus to go back to the textbox, but the default behavior of the Enter...
1
by: Jeff Gerber | last post by:
/* This test program will give a "Value cannot be null" error. If the lock in this code is removed (or Monitor.Enter()) the program will run as expected. I have found no explaination in...
0
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
5
by: Eric | last post by:
Hi All, I'm very experienced in traditional ASP and am new to (am learning) ASP.NET. FYI: I am initially learning ASP.NET with VB.NET to ease the transition for me. I have encountered what I...
2
by: 23s | last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm in either of those textboxes (i.e., either one of the textboxes has focus), in any given browser, hitting "enter" on my...
4
by: Frank Reichenbacher | last post by:
In MS Access VB, which I have been using for several years, the default enter key behavior in a textbox is identical to the tab key. Data are read and the focus moves to the next control in the tab...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.