471,058 Members | 978 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Key press

Hello.

In Event key_press I write
If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok. CTRL+BACKSPACE = DEL, but with del it doesn't work.

Can anybody write me where is problem?

Thanks.
Nov 20 '05 #1
6 9505
Hi,

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Delete Then
MessageBox.Show("Delete pressed")
End If
End Sub

Ken
--------------
"Rado" <r-****@szm.sk> wrote in message news:uu**************@TK2MSFTNGP10.phx.gbl...
Hello.

In Event key_press I write
If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok. CTRL+BACKSPACE = DEL, but with del it doesn't work.

Can anybody write me where is problem?

Thanks.
Nov 20 '05 #2
Hi,

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Delete Then
MessageBox.Show("Delete pressed")
End If
End Sub

Ken
--------------
"Rado" <r-****@szm.sk> wrote in message news:uu**************@TK2MSFTNGP10.phx.gbl...
Hello.

In Event key_press I write
If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok. CTRL+BACKSPACE = DEL, but with del it doesn't work.

Can anybody write me where is problem?

Thanks.
Nov 20 '05 #3
"Rado" <r-****@szm.sk> schrieb

In Event key_press I write
If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok.
CTRL+BACKSPACE = DEL, but with del it doesn't work.

Can anybody write me where is problem?


First, your keyboard (and it's driver) produces "virtual keycodes". Whenever
a key is held down or released, the keydown or keyup events are raised. In
the event handlers, e.keycode contains the virtual keycode. (Almost) all
keys create this message and event.

Second, some of the keys or a combination of them are translated to input
chars afterwards. Others don't, like the function keys. If you press delete,
no input char is created. Use the keydown event to handle the Delete key.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
"Rado" <r-****@szm.sk> schrieb

In Event key_press I write
If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok.
CTRL+BACKSPACE = DEL, but with del it doesn't work.

Can anybody write me where is problem?


First, your keyboard (and it's driver) produces "virtual keycodes". Whenever
a key is held down or released, the keydown or keyup events are raised. In
the event handlers, e.keycode contains the virtual keycode. (Almost) all
keys create this message and event.

Second, some of the keys or a combination of them are translated to input
chars afterwards. Others don't, like the function keys. If you press delete,
no input char is created. Use the keydown event to handle the Delete key.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* "Rado" <r-****@szm.sk> scripsit:
In Event key_press I write

If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is* key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok.* CTRL+BACKSPACE = DEL, but with del it doesn't work.


Compare 'e.KeyChar' to one of the 'Keys.*' constants.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
* "Rado" <r-****@szm.sk> scripsit:
In Event key_press I write

If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then

Asci 127 is* key DELET.

But it doesn't work, when I get other Ascii It's ok.

And When I press CTRL+BACKSPACE with ascii 127 it's ok.* CTRL+BACKSPACE = DEL, but with del it doesn't work.


Compare 'e.KeyChar' to one of the 'Keys.*' constants.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by John Howard | last post: by
6 posts views Thread by Johan Svedberg | last post: by
5 posts views Thread by junk mail | last post: by
1 post views Thread by =?Utf-8?B?QXNhZg==?= | last post: by

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.