ALT-key blocking query

  • Thread starter Thread starter Patrick De Ridder
  • Start date Start date
P

Patrick De Ridder

In order to block using the ALT butto,

I use

tb.KeyPress += etc

and

a function containing

if(e.KeyChar == (char)56)
e.Handled is true;

No syntax errors,
however, this isn't working.

Please comment.
Thank you,
Patrick.
 
Patrick,

The KeyPress event doesn't handle the ALT key. Rather, you will have to
use the KeyDown and KeyUp events to handle that key.

Hope this helps.
 
Thanks. I'll give it a try.

Patrick.


Nicholas Paldino said:
Patrick,

The KeyPress event doesn't handle the ALT key. Rather, you will have to
use the KeyDown and KeyUp events to handle that key.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Patrick De Ridder said:
In order to block using the ALT butto,

I use

tb.KeyPress += etc

and

a function containing

if(e.KeyChar == (char)56)
e.Handled is true;

No syntax errors,
however, this isn't working.

Please comment.
Thank you,
Patrick.
 
Back
Top