Check If A Certain Key Is Being Pressed?
Mar 31, 2011I need to check if the SHIFT or CTRL keys are being pressed in my VB.net application? (get a boolean)
View 3 RepliesI need to check if the SHIFT or CTRL keys are being pressed in my VB.net application? (get a boolean)
View 3 RepliesHow would I check if a key is currently being pressed?
Also how would I detect if a key is pressed without using the KeyDown event. The reason I am not using the keydown event is when the user holds down a key it calls the event, waits a second than keeps calling it. I do not want the wait period if a user is holding down a key.
How can I check if a perticular button was pressed first?
I need something along the lines of:
if btnNewGame.wasPressedFirst then
do this
else
do this
How do I check if Control + Z is being pressed?
I managed to check for when one key is being pressed, but apparently I can't check for two at the same time.
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
What is the keyValue I need for checking for the DELETE key using e.keyValue?
How can I check if an arrow key (dunno, the right key for example) is pressed?
View 1 RepliesHow to check whether user pressed any key other than numeric in VB.NetWorking as a software engineer
View 2 Repliesi need to take input in text box that will be integer. when the button is press it will check whether the input is integer.
can i do this using isNumeric Function?how?
How can I set a button, so that when it is pressed, it stays in the pressed down graphic state. Then when pressed again it returns to the normal not-pressed visual.Make a button stay like this until pressed again: url....
View 3 RepliesI have a TextBox and set the MiltiLine property to true and AcceptsTab property to false.When the TextBox has focus and i press Tab it works fine and the next control get the focus, but when i press Ctrl+Tab it works as if AcceptsTab property is set to true and makes a tab character into the TextBox.The reason i press Ctrl+Tab.. when switching between forms in my MDI application.Now how to make a Ctrl+Tab when pressed works like Tab when pressed in a MultiLine TextBox?
View 1 RepliesI am trying to do the following check to see if the user presses the Cancel button or the exit application (X). But for some reason it is not working. Can anyone let me know what am I doing wrong?
CheckCancel
If NewStationInfo.CancelButton.DialogResult = Windows.Forms.DialogResult.OK Then
do sometheing
[code].....
Private Sub ContextMenuStrip_ForDisplay_Opening(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip_ForDisplay.Opening
If Utility.IsKeyDown(Keys.S) OrElse Utility.IsKeyDown(Keys.V) Then
[Code]....
I do the above to cancel the menu if S or V is pressed.
I'd like to cancel if ANY key is pressed.
i have a pocket pc that have some special keys and i need detect when a key is pressed in my program. how can i detect the keys that is pressed? i have tested in a textbox change function the box detect all keys except that special keys there is some api to look for alk keys thats is pressed in pocket pc?
View 3 RepliesAll i wish to do is have some simple code, which can detect when the esc key is pressed, (if possible can you point out where i need to change to set it for an other key).
View 5 RepliesHow do I find out if any key is pressed during a certain time?i have a timer to the "certain time" is no problem.But how do I find if any key is pressed?
View 14 RepliesI'm looking for a way to find when no key is pressed. I'm creating a game and I have an animated characted. When you press the movement keys he moves and is animated. I need to know when no keys are being pressed so I can tell the animation to stop.
View 1 RepliesThis may sound like a dumb question but I need to know. I know you can tell which keys are pressed on the keyboard but I like to know if I can do something.Ok, heres what I am trying to do. A user is in another program that is max on the screen. He has to press Print Screen to take a screenshot, but he got to min the screen he is in to paste the screenshot into paint. This causes slow loads on maxing that screen and sometimes crashs of the program. I already got the code done to check when the program is running and to capture the screenshot and save it. What I to do now is, find out while in the other program with my program running in the background, if the user has pushed the Print Screen button.
View 2 RepliesHow do i get if a Key is pressed on the whole form. Like A? or Ctrl + A
View 5 Replies'pressing F1 key on main form. I dont know how to trap whether user pressed F1 key or not
Private Sub frmMain_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
Dim KeyAscii As Long = Asc(e.KeyChar)
[code]....
How to make a key being pressed do something?If 'w' is pressed, then...
View 2 RepliesSo i just wrote this awesome program, but now it doesn't run when I try to! When I press F5, or press the run button, this error happens:
View 6 RepliesI want to make it so that if the key 'shift' is pressed it does something. I have this VB.Net
If Keys.Shift = 1 then
MessageBox.Show("pressed shift")
I have a webform and i want to detect if F5 button was pressed or if the page was refreshed. I know about postback but it is not what i'm looking for. I have a gridview that loads in a modal popup when a button is clicked and a parameter's value is set for the gridview. When refresh is hit and if the modal popup button was previously clicked the modal popup is visible right after refresh. I want to detect if the page is refreshed to prevent this. any ideas? I thought to try Override but I'm not exactly sure how to use it. I tried Control.ModifierKeys but I don't have access to ModifierKeys.
View 2 RepliesIm doing a small project in visual basic which involves lighting up leds through the parallel port and turning them on and of. each led is controlled by a checkbox on my form and they only come on when the checkbox is checked.
what code do i need to use to have the checkbox checked when a key is pressed but when the key is released the checkbox is unchecked i have already tried keydown which will check the box when a key is pressed but will not uncheck it when the key is released
If e.KeyValue = Keys.A Then
CheckPin1.CheckState = CheckState.Checked
ElseIf e.KeyValue <> Keys.A Then
CheckPin1.CheckState = CheckState.Unchecked
End If
I am making a Tetris program and I have a 2d array 10 by 20 for the grid.I want the Tetris blocks I have created to move down one block every second unless the user presses "a" or "d" (to move left or right) then the block should move left or right whilst moving down.The problem is that I have created a loop for it to delay a bit but then it waits for the user to press a key until it continues the program. So the block will stop moving down and just stay where it is until they press something.I have been told that you can do this in C with something like if keyboardhit or kybd() or something then it will read the key but otherwise it will just skip that bit and loop round. So how can I do this in VB?
View 2 RepliesHow can i count keys pressed within ex. 1 min? Or how do i count a spesific key?
View 1 Replieshow can I check with getasynckeystate, if ctrl+c was pressed?
getasynckeystate(17) and getasynckeystate(67) doesn't seem to work
even getasynckeystate(17) and getasynckeystate(67) and &H8000 doesn't work too
I know that you cannot disable Ctrl Alt Del for security reasons. I was able to figure out how to disable ALT+F4 in my application though. What I am wanting to know is if anyone can give me some code to where If CTRL ALT DEL is pressed then my application will close. I have tried everything, and I just cannot seem to get the program to recognize if the user presses ctrl alt delete.
So basically I need some code that detects if a user presses ctrl alt delete then if htye did it closes the application.
(I am making a quiz program.)
PS: I am on Windows 7 RC and I also use Windows Vista. I am using Visual Studio 2008 Professional Edition.
I have a series of textboxes that I need the user to be able to navigate. When the last textbox in the series is filled I want the cursor to go to the first box in the series and have the next row in the datagridview selected. The problem is, for some reason, the tab button being pressed (keyup, keydown, and keypress) is not being detected by the conventional handling of those events. Instead, the tab on that box goes to the next item in the tab index.How would I capture that key or key press event and execute my code?
View 3 RepliesI have a few problems with my VB.NET project. I am making an application that should track every key inputted by the user. This may sound scarily like a keylogger, but it is intended for statistics purpose only. All data is stored on the client's computer and will not be sent anywhere on a network or the Internet.
The problem is actually figuring whether or not a key is pressed globally. That means, not in a KeyDown, KeyUp or KeyPress event. Let's say if the user inputs anything in Microsoft Word, my application will notice.
I have already tried this code. It gives PInvokeStackImbalance errors in the MDA. It has actually worked out for another application I am making, until I figured the severity of this error.
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub CAKS(ByVal Key As Long)
Dim WasBeingHeld As Boolean = False
[Code]....