473,320 Members | 1,821 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,320 software developers and data experts.

Enter Key ignored...REALLY weird bug

This is so weird, and I cannot even isolate the cause enough to give any
clues as to how to reproduce the error, so this is probably a real shot
in the dark...

BUT, has anyone ever run into a situation where pressing the enter key
on a textbox control is NOT captured by the KeyPress event?

Now before you ask:

-- The form does NOT have a default button selected.
-- The form does have key preview set to true, but setting it to false
has no effect on this problem.
--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
9 1265
Hi Zorpie

I'm guessing that if you can cut your project down to the minimum set where
this problem still occurs, and you post it here, someone will be able to
spot the problem pretty quickly.

Charles
"ZorpiedoMan" <No********@Beatles.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
This is so weird, and I cannot even isolate the cause enough to give any
clues as to how to reproduce the error, so this is probably a real shot
in the dark...

BUT, has anyone ever run into a situation where pressing the enter key
on a textbox control is NOT captured by the KeyPress event?

Now before you ask:

-- The form does NOT have a default button selected.
-- The form does have key preview set to true, but setting it to false
has no effect on this problem.
--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #2
Rud
Hi Zorpie,

I'm having similar problems. It's really strange: I have a picturebox
control and all KeyDown events are nicely catched by the forms KeyDown
routine. Only four keys are not catched: the four arrow keys...

How did you solve your enter key problem...???

Thanks, Rud.
"ZorpiedoMan" <No********@Beatles.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
This is so weird, and I cannot even isolate the cause enough to give any
clues as to how to reproduce the error, so this is probably a real shot
in the dark...

BUT, has anyone ever run into a situation where pressing the enter key
on a textbox control is NOT captured by the KeyPress event?

Now before you ask:

-- The form does NOT have a default button selected.
-- The form does have key preview set to true, but setting it to false
has no effect on this problem.
--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #3
Rud -

Well, I never ended up finding the cause of my problem and found another
work around.

Your problem, however, is this: The arrow kesy (as well as pgUp, pgDn,
Home, End and a handful of others) is NOT captured by the keypress
event. You need to use the KeyDown or KeyUp event to catch these...

Good Luck.

--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #4
Rud
Thanks Zorpie,

I am using the KeyDown event and not KeyPress (see my mail)! The problem is
as followes: I have an MDI form with two child forms. No matter what I do to
trap the arrow key in the child form, pressing the arrow keys result in:
1) Focus is switched to the next (or previous) open MDI child window, and
2) The KeyDown event is not captured by the child forms KeyDown routine...
For sure "KeyPreview = true" is set for the child form.

I have solved issue 2) - such that I am trapping the arrow key event - as
follows:

Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
MsgBox(keyData)
MyBase.ProcessCmdKey(msg, keyData)
End Function

But I can not manage to stop the unwanted behaviour that pressing the arrow
keys also results in switching the focus from one MDI child form to the
other....

Thanks,

Rud.
"ZorpiedoMan" <No********@Beatles.com> wrote in message
news:OJ**************@tk2msftngp13.phx.gbl...
Rud -

Well, I never ended up finding the cause of my problem and found another
work around.

Your problem, however, is this: The arrow kesy (as well as pgUp, pgDn,
Home, End and a handful of others) is NOT captured by the keypress
event. You need to use the KeyDown or KeyUp event to catch these...

Good Luck.

--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #5
oops, sorry for the dumb answer. I never went back and read your
comment... I was tired.

anyway, I can't even duplicate your problem. is the picture box the
ONLY control on the child forms?

--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6
Rud
It was, I temporarely solved the whole problem by placing a "dummy" TextBox
on the form as well. I positioned it outside the form (0,-40) such that it
is invisible for the user. Disabeling did not solve the problem. So for some
reason as long as there is a control (textbox, or commandbutton) that has or
can have the focus all key events are raised. As soon as the picturbox is
the only control again the strange behaviour occurs...

Rud.
"ZorpiedoMan" <No********@Beatles.com> wrote in message
news:ec**************@TK2MSFTNGP09.phx.gbl...
oops, sorry for the dumb answer. I never went back and read your
comment... I was tired.

anyway, I can't even duplicate your problem. is the picture box the
ONLY control on the child forms?

--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #7
Rud -

You know, now that you describe your situation and your work around, I
remember years ago making that SAME discovery, even in VB6. I forget if
I ever found out why it behaves that way though. Anyway, good luck!
Looks like you are back on track now.

--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #8
Please try the KeyDown event, which can return the Key presed value.

Note
There is also the AcceptsReturn property of the text box, which is False
by default.

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #9
Zorpiedo Man,

Calling somethig a "bug" needs a good documented explanation of what
something should do confirm the documentation and a sample to reproduce the
bug.

When you can not produce that, you can call it only a bug in your programma
and than you should write that in the subject of this message in my opinion.

Now you give me the idea that you only want to blamme the programmers from
Microsoft with your own incapacity.

Not saying that it is as I wrote above, however in the way you do this
giving me strongly the idea.

And than it is not nice in my opinion.

Cor

"ZorpiedoMan"
...
This is so weird, and I cannot even isolate the cause enough to give any
clues as to how to reproduce the error, so this is probably a real shot
in the dark...

BUT, has anyone ever run into a situation where pressing the enter key
on a textbox control is NOT captured by the KeyPress event?

Now before you ask:

-- The form does NOT have a default button selected.
-- The form does have key preview set to true, but setting it to false
has no effect on this problem.
--Zorpie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #10

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

Similar topics

5
by: Alan Zhong | last post by:
i am trying to similate an "ENTER" as a key to switch focus in a sequence of text inputs. i don't want to use "event.keyCode" since i want to do additional testing before i decide which text input...
1
by: Tony LaPaso | last post by:
Hi All, I hope I am not "over-posting" to this group. I'm coming up to speed on CSS and so questions come along. This seems too weird. For some reason, Firefox 1.0.4 (as well as IE 6/Win) is...
9
by: Jaxon Bridge | last post by:
This is really weird, and is a problem only on IE 6 for me, but not Firefox. Here is the code: <td colspan=3 class=allmessagesheader>Pictures from Europe<br><br><br>December 10, 2000</td> ...
37
by: thierry38080 | last post by:
Hi, I created a CSS that work fine on my IE 6.0.2900 (SP2) but I'm having customers that have problems with it and they're on IE 6.0.2800 (SP1)... The problem looks like if the stylesheet (in...
0
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control,...
3
by: GS | last post by:
If I were to capture enter key on keyup event of an GUI object like comboBox box, How do I avoid killing ctrol-c, controlv, controlx, shift-insert, shiftdelete, contrl-insert
0
by: P Pulkkinen | last post by:
Dear all, sorry, i know this code is far little too long to debug here, but there is really annoying logical error. If someone debugs this, I really offer warm virtual handshake. What this...
10
by: Tim Streater | last post by:
I have a form and a button to submit it. The button is made from: <input type=button onclick='myHandler(this.form);'> This all works fine except that in Safari 2.0.4, the enter/return keys, if...
2
by: Sunfire | last post by:
I was wondering if there was a way to hit enter to insert blank lines while in the designer? I tried this but all it seems to want to do is insert code that really shouldn't be there. For example,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.