A KeyEvent is an event that is triggered when a Key is pressed on a keyboard input device. The KeyEventArgs
contain information relating to the particular key that was pressed, how long the key was pressed for, and whether any modifier keys were also pressed (such as Ctrl or Alt).
Questions tagged [keyeventargs]
44 questions
0
votes
1 answer
KeyEventArgs KeyData.ToString() returns backwards key press
I have a KeyEvent called Bind that captures two key presses (Ctrl + Ins)
I want to return this as a string but when I do using (Bind.KeyData.ToString()) the string is backwards and instead of ( Control, Insert ) it returns ( Insert, Control ). How…
0
votes
1 answer
Send TextBox KeyEventArgs value before exiting event
I have this:
private void AssociatedObject_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
TextBox textBox = sender as TextBox;
if (textBox != null)
{
if (e.Key == Key.Return)
{
…

JP Garza
- 212
- 3
- 16
0
votes
0 answers
KeyEventArgs not found
My Key Event is not working on asp.net. I haven't really got an idea on how to fix it. I searched the internet or answers but haven't found them. So maybe you could help me.
Error code:
The type or namespace name 'keyeventargs' could not be found…

Aiko
- 153
- 2
- 16
0
votes
0 answers
WPF KeyDown KeyEventArgs.Handled
I'm writing an application which has multiple states. The states are swapped by pressing space, and current state is stored in an enum. I handle the swapping by KeyUp and KeyDown Event.
I want to achieve:
When I press (and hold) the space key, I…

Krepsy 3
- 63
- 1
- 2
- 11
0
votes
0 answers
How to make a button move based on user input
I have been trying to make a button in C# move based on the user pressing various arrow keys under a Form1 KeyDown method, but i cannot figure out how to make the value of e equal to the users input.
So far i have:
private void…

Alex V
- 25
- 4
0
votes
1 answer
Keyboard input in C# and WPF not working
I am developing a small game where there are ellipses as targets and textblock over those ellipses displaying an Alphabet(changes every 3 sec).
I want to implement a functionality where a user presses an alphabet on keyboard and if that matches with…

sketch_TF2
- 61
- 1
- 9
0
votes
1 answer
KeyEventArgs not responding to pressing escape button
I have a WinForm application in which i whish to use the escape button to close a control. I have created an event on KeyPress and this works when i use any other key than Escape.
private void ProductsView_KeyPress(object sender, KeyPressEventArgs…

kodeaben
- 1,829
- 3
- 24
- 33
0
votes
2 answers
Adding Text to a text box with KeyEventArgs. C#
I can't seem to have this part of my code to work. The objective for this piece of code is to add a numbered list every time The user presses, "ENTER". Here is and example of what I mean.
0)10100[User presses the ENTER key]
1)(cursor is here)
Here…

Franco Pettigrosso
- 4,056
- 2
- 20
- 32
0
votes
0 answers
What is a better way to respond to numeric keypresses?
I want to allow the checking of radio buttons via the keyboard, specifically via the numbers 1, 2, 3. I've got this code that works:
// "a WPF form hears what it wants to hear and disregards the rest" - paraphrased from "The Boxer" by Simon &…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
0
votes
0 answers
c# keyboardHook : e.Control always false on KeyPress event
I am recording user actions for a study (people taking part of the study are aware that their actions are recorded), therefore I have been building a little keylogger in C#.
Thanks to msdn doc and some tutorial I could make something work quite well…

vbvx
- 609
- 7
- 22
0
votes
0 answers
Calling method with "keyEventArgs" as argument
I have 2 questions.
The first main question is how do I fix the error I have when trying to invoke the method that contain KeyEventArgs e as argument. I only know how to deal with arguments when they are variables.
The Second is just a quick…

FunBugs
- 1
- 1
0
votes
0 answers
C# two functions called on one keyevent, ok but the first wait for the second to finish
my first function fill a listbox with a string from a textbox, the second upload a file with ftp protocol.
The two functions are called when i press the key Return and it works fine...but listbox is filled only when the second function has uploaded…
0
votes
1 answer
Trapping keystrokes with Form1_KeyDown(...)
I'm trying to make a form move left or right denoted by a primary keystroke by a number of pixels denoted by a secondary keystroke but so far I've not been able to do anything. As far as I can tell I should have no problem here. I have set…

Roadblock
- 1
- 1
-1
votes
2 answers
C# Compare the Key Pressed on the Keyboard
I have a textbox and a button.I'm saving the value(keyboard key) entered in the TextBox.I need to give a message when I press the right keyboard key.
private void btn_Click(object sender, EventArgs e)
{
Properties.Settings.Default.text1 =…

H.Marcus
- 31
- 7