473,385 Members | 1,907 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,385 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 9846
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Howard | last post by:
I'm trying to write a simple press any key routine, but am having some problems. Here is the routine: void PressAnyKey () { cout << "Press Any Key"; do{}while (!kbhit()); getch(); cout <<...
6
by: Johan Svedberg | last post by:
Hi! I read somewhere that it is impossible to write a program in ANSI-C which only reads one char from the keyboard without having to press Enter (i.e. -questions). Is this true? -- Johan...
5
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number...
0
by: neeraj | last post by:
Hi Everybody I have one problem in my asp.net web application. The problem is that I check the date validation in code behind; if user not gives the valid data and press save button then I fire...
9
by: Susan Rice | last post by:
I'm running a simple win32 console application and I want to impliment a "Press any key to continue", so I print that prompt, and then what's the easiest way to impliment reading any key? Do I use...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have a Default.aspx page with several controls in a Master Page. When pressing on a Button control Page_Load event is fired on the Default.aspx page and after that the Page_Load event...
3
by: win | last post by:
How to get the keycode press in a web form Vincent
4
by: Joshua2010 | last post by:
I have been trying to merge two command scripts, and have gotten nothing. I am trying to use javascript commands to open a new window on Firefox, and on that opened window simulate a Tab key press....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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...

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.