472,956 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,956 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 9781
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.