By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,799 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,799 IT Pros & Developers. It's quick & easy.

OnKeyUp anomaly

P: n/a
Using VS .NET 2003 on an up-to-date XP Pro machine:

I'm getting bizarre results in a VB Windows app trying to implement the
OnKeyUp event handler. I have a form with a label control and code simialr
to the following:

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows.Forms.KeyEventArgs)

Select Case e.KeyCode
Case Keys.Up
lblKeyVal.Text = "Up Arrow"
Case Keys.Enter
lblKeyVal.Text = "Enter"
Case Keys.Escape
lblKeyVal.Text = "Escape"
End Select

End Sub

When I run this code on a sample project with no other code in it it seems
to run fine. However, when I place this identical code into my development
project, strange things happen. When I press either the *Enter* or the
*Escape* key, it works as expected. However, as soon as I press the *Up
Arrow* key, the program ceases to respond to key presses. If I place a
breakpoint at the first line of the Sub, it breaks there for every *Enter*
and *Escape* keypress until the first time I press the *Up Arrow*. Pressing
the *Up Arrow* does not result in execution halting at the breakpoint, and
afterwards the *Enter* and *Escape* keys also fail to activate the
breakpoint.

Any ideas???

TIA

William Barnes
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
William Barnes wrote:
Using VS .NET 2003 on an up-to-date XP Pro machine:

I'm getting bizarre results in a VB Windows app trying to implement the
OnKeyUp event handler. I have a form with a label control and code simialr
to the following:

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows.Forms.KeyEventArgs)

Select Case e.KeyCode
Case Keys.Up
lblKeyVal.Text = "Up Arrow"
Case Keys.Enter
lblKeyVal.Text = "Enter"
Case Keys.Escape
lblKeyVal.Text = "Escape"
End Select

End Sub

When I run this code on a sample project with no other code in it it seems
to run fine. However, when I place this identical code into my development
project, strange things happen. When I press either the *Enter* or the
*Escape* key, it works as expected. However, as soon as I press the *Up
Arrow* key, the program ceases to respond to key presses. If I place a
breakpoint at the first line of the Sub, it breaks there for every *Enter*
and *Escape* keypress until the first time I press the *Up Arrow*. Pressing
the *Up Arrow* does not result in execution halting at the breakpoint, and
afterwards the *Enter* and *Escape* keys also fail to activate the
breakpoint.

Any ideas???

TIA

William Barnes


Are you handling anything in the OnKeyDown or ProcessCmdKey events?

Chris
Nov 21 '05 #2

P: n/a
No, the only overrides are this one and OnPaint()
William
"Chris" <no@spam.com> wrote in message
news:%2*****************@TK2MSFTNGP09.phx.gbl...
William Barnes wrote:
Using VS .NET 2003 on an up-to-date XP Pro machine:

I'm getting bizarre results in a VB Windows app trying to implement the
OnKeyUp event handler. I have a form with a label control and code
simialr to the following:

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows.Forms.KeyEventArgs)

Select Case e.KeyCode
Case Keys.Up
lblKeyVal.Text = "Up Arrow"
Case Keys.Enter
lblKeyVal.Text = "Enter"
Case Keys.Escape
lblKeyVal.Text = "Escape"
End Select

End Sub

When I run this code on a sample project with no other code in it it
seems to run fine. However, when I place this identical code into my
development project, strange things happen. When I press either the
*Enter* or the *Escape* key, it works as expected. However, as soon as I
press the *Up Arrow* key, the program ceases to respond to key presses.
If I place a breakpoint at the first line of the Sub, it breaks there for
every *Enter* and *Escape* keypress until the first time I press the *Up
Arrow*. Pressing the *Up Arrow* does not result in execution halting at
the breakpoint, and afterwards the *Enter* and *Escape* keys also fail to
activate the breakpoint.

Any ideas???

TIA

William Barnes


Are you handling anything in the OnKeyDown or ProcessCmdKey events?

Chris

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.