Hello world! I am requiring some assistance with my C# program, where I am getting an error message for having a form where the user would enter in text into a text box. I am trying to detect if the user has pressed the Enter key, and on doing so would produce a message box with a message. However, I am trying to call the "KeyEventArgs" class which would allow me to detect the key press, but receive the following error message: **No overload for 'TextBox_KeyDown' matches delegate 'System.EventHandler'** Here is my code for the TextBox I am using: private …

Member Avatar
Member Avatar
+0 forum 2

I need to highlight the current key pressed in my C# application. To get the keyboard keys code during keyDown and keyUp events i tried returning the keycodes as protected override void OnKeyDown(KeyEventArgs keyEvent) { // Gets the key code lblKeyCode.Text = "KeyCode: " + keyEvent.KeyCode.ToString(); } Other way i tried was to check if each key that i need is pressed namespace test { public partial class Form1 : Form { public Form1() { InitializeComponent(); // Create a TextBox control. Button enterBtn = new Button(); this.Controls.Add(enterBtn); enterBtn.KeyPress += new KeyPressEventHandler(keypressed); } private void keypressed(Object o, KeyPressEventArgs e) { // …

Member Avatar
Member Avatar
+0 forum 1

I have seen similar questions which attempt to solve this issue, but none seem to work for me so far... Basically, for my first VB project, I am creating a virtual keyboard where a sound is played from the resources on KeyDown. So far, the program seems to work except for the fact that each key needs to be clicked by the mouse before the sound is played by pressing each key (hence put the object in focus), where I need the key to play the sound without clicking the keyboard key (put the object in focus on KeyDown). Below …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone! I need to make a simple yet cool program for my professor. The program is this: To get the program to work, the user first presses a button on the form. Then, when the user presses an up arrow on the keyboard, the cursor will change to a custom cursor (a cursor with an image of car {in .ico format} for example), when the user releases the up arrow key, the cursor turns back to default cursor -- which is arrow. When the user presses an up arrow and left arrow at the same time on the keyboard, …

Member Avatar
Member Avatar
+0 forum 15

Hi again, sorry for yet another thread. I am using the KeyDown function in my form and it is not able to perform because of the other controls. For example, there is a text box in the form. Once the form has loaded, when I press vbKeyRight, my code does not run because the cursor is at the textbox and it is not the form getting the event. The same is true if there is a WebBrowser in the form. When I press vbKeyRight, instead of my codes executing, the browser just scrolls to the right. How do I set …

Member Avatar
Member Avatar
+0 forum 21

Okay, this is just a simple trick to determine whether CAPS is pressed because some people here use API to determine whether the CAPS Lock is pressed. [QUOTE] KeyDown and KeyUp don't detect exactly the same information as KeyPress. KeyPress detects a character in its KeyAscii parameter, but KeyDown and KeyUp detect a physical keystroke in their KeyCode parameter. [LIST] [*]KeyUp and KeyDown can detect keystrokes not recognized by KeyPress, such as function, editing, and navigation keys. [*]KeyPress can distinguish between different ASCII characters generated by the same physical keystroke. [/LIST] [/QUOTE] Where did I get KeyCode = 20? Try …

Member Avatar
Member Avatar
+0 forum 7

The End.