Member Avatar

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
+0 forum 2
Member Avatar

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
+0 forum 1
Member Avatar

Hey. I am trying to make a "virus" that will not let the user exit the program even with pressing Command+Q (oh, ya, I have an Apple). Here is what I have so far: if (keylistener.getKeyCode()==81){ System.out.println("Works"); } I have the println just to see if it works (which it does), but is there a way to "kill" the request or have the computer not recognize the command key if pressed? Thanks in advance!

Member Avatar
+0 forum 2
Member Avatar

Hey, Is there a way to get the keycode from a char? I tried using KeyEvent.getKeyCode() but the KeyEvent class didn't have a constructor so it was freaking out. I've been searching for 2+ hours already and nothing. My goal is to have a char, convert it to keycode, and then use the keycode in the robot class's KeyPress([keycode]) method.

Member Avatar
+1 forum 2
Member Avatar

hello all i have a jsp page in which i am using a function for detecting the ascii value of key pressed.it has to give alert if other than any alphabet key is pressed.Below giving the explaining code [CODE] function checkname(e) { var cc=e.keyCode; if(cc >=65 && cc <=90 || cc >=97 && cc<=122) { return true; } else { alert (""+cc+""); alert("Enter only alphabets"); return false; } } <td><input type="text" name="name" maxlength="20" onkeypress="return checkname(event);" /></td> <td width="57%"><input type="text" name="user_id" maxlength="20" onkeypress="return checkname(event);"/></td> [/CODE] but when i go to write any alphabet in textbox it gives alert "Enter only alphabets".i …

+0 forum 0
Member Avatar

Hi Guys, Probably a simple one but im struggling to find it in VS 2008. How do you enable a VB program to allow a user to press enter rather than click on the button? I have a text box which the user types a number and then clicks a button which runs the script. I want the user to be able to either press enter once they enter a number or click on the button. I thought there was a setting in properties to do this but I am struggling to find it - also no joy searching online …

Member Avatar
+0 forum 6

The End.