473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How do i check if a key has been pressed

Mague
137 100+
Hey,


Ive searched the internet but havnt found anything. Im making a program whicih will repeat typing text which has been entered. BUT to start it they click on the client and click Ctrl R to start the only problem is i dont know how to make it do that! if som1 could help me i would appresiate it alot. Please dont call me a noob (i no i em) also im only 13 so yea!



Ty Mague
May 27 '07 #1
5 2226
SammyB
807 Expert 512MB
Hey,


Ive searched the internet but havnt found anything. Im making a program whicih will repeat typing text which has been entered. BUT to start it they click on the client and click Ctrl R to start the only problem is i dont know how to make it do that! if som1 could help me i would appresiate it alot. Please dont call me a noob (i no i em) also im only 13 so yea!



Ty Mague
Assuming you are using VB.Net, use the form's KeyDown Event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
  2.     If e.KeyData = (System.Windows.Forms.Keys.Control + System.Windows.Forms.Keys.R) Then
  3.         MessageBox.Show("Start")
  4.     End If
  5. End Sub
  6.  
May 27 '07 #2
Mague
137 100+
Thank you so much!!!! You have helped me heaps
May 27 '07 #3
Mague
137 100+
Ive still got a Problem i tried to out this code in and it still didnt work. It had no errors (mistakes (cant spell)) but when i ran the program and pressed the button nothing happened
May 27 '07 #4
Mague
137 100+
Woops soz i accidently typed wrong :( Its working perfectly :)
May 27 '07 #5
Helmer
10
hey if u can get a chart for the keycodes of the keys on a keyboard, im sure u are all familiar with a case statement...
form keydown event

select case Keycode
case vbkeyX' x=keycode
here u put wat u want t happen wen that key is hit
case vbkeyY y=keycode
here u put wat u want t happen wen that key is hit
end select

for most keys the keycode is the keyname ex K's keycode is vbkeyK, etc
May 28 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Dave Smithz | last post by:
Hi there, A PHP application I built has a section which lists a number of members to a club whose names each appear with a check box beside them that can be ticked. These check boxes are part...
7
by: Brian | last post by:
Inside a loop, I need to passively check to see if a key is pressed or not without pausing like raw_input does. Some pseudocode: While true: If a key is pressed which key is pressed do...
0
by: Marco Singer | last post by:
Hi all, is it possible to check if a key was pressed in a VB.NET console application? I have a loop which runs a long time and want it to exit if a key was pressed. What I NOT want is to wait...
6
by: Marco Singer | last post by:
Hi all, is it possible to check if a key was pressed in a VB.NET console application? I have a loop which runs a long time and want it to exit if a key was pressed. What I NOT want is to wait...
3
by: Just Me | last post by:
I need to set the mouse cursor to wait and also check to see if Esc has been pressed. To see if Esc has been pressed I do Application.DoEvents before I check a variable that gets set in...
6
by: Stefan Mueller | last post by:
With the following code I can figure out if 'Enter' has been pressed: ... onKeyPress = "if (check_enter(event)) {alert('Enter has been pressed');}" function check_enter(eventobjekt) { var...
3
by: Andrew | last post by:
I am new to VBA Please can someone help get me started. I need to know how to use an if statement to check if a button has been pressed i.e. if button 1 is pressed a file will be imported from...
7
by: hlubenow | last post by:
Hello, I'd like to check, if a single key is pressed on a Linux xterm. This code waits for a key to be pressed and returns the character: -------------------------------------------- ...
19
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make...
1
by: rdsandy | last post by:
Hi, Im using Access 2003. I have a form, with two buttons and a list box. When a user selects an item in the list box, the user clicks on one of the buttons which opens up the selected record. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.