keyeventargs

Stop the Bell on CTRL-A (WinForms)

Any ideas how to stop the system bell from sounding when CTRL-A is used to select text in a Winforms application? Here's the problem. Create a Winforms project. Place a text box on the form and add the following event handler on the form to allow CTRL-A to select all the text in the textbox (no matter which control has the focus). void...

How do you convert a System.Windows.Input.KeyEventArgs key to a char?

I need to get the event args as a char, but when I try casting the Key enum I get completely different letters and symbols than what was passed in. How do you properly convert the Key to a char? This is what I've tried ObserveKeyStroke(this, new ObervableKeyStrokeEvent((char)((KeyEventArgs)e.StagingItem.Input).Key)); Edit: I also do...

C#: Getting the correct keys pressed from KeyEventArgs' KeyData

I am trapping a KeyDown event and I need to be able to check whether the current keys pressed down are : Ctrl + Shift + M ? I know I need to use the e.KeyData from the KeyEventArgs, the Keys enum and something with Enum Flags and bits but I'm not sure on how to check for the combination. ...

No overload for 'insert_method_here' matches delegate 'System.EventHandler'

I am trying to build a program that has a button, and everytime that button is clicked, it moves the button and adds to the score. However, I am trying to disable the Enter key, or suppress the command when pressed. Here is what I have so far private void button1_Click(object sender, EventArgs e, KeyEventArgs k) { if (k.KeyC...

How to forbid backspace key in WPF

Hi all How can I forbid the Backspace-Key as easy as possible in a WPF-Application? The KeyDown-Event don't catch at the DEL and the Backspace-Key. Thank you! ...