I'm working on a project that contains hotkeys, but I don't wish to have global hotkeys. At the moment, I'm using KeyDown and e.KeyCode for hotkeys. I've created test projects where these worked perfectly fine, but on my main project, they don't register.
Is there any built in way to get the key name from the decimal alt codes returned by KeyEventArgs.KeyCode? e.g. get "Space" from 32 If not I guess I'll have to create a huge array.
I'm trying to determine when the 'Left' and 'Right' keys are pressed, for keys that have a counter part. Like, Shift, Alt and Control. But it doesn't seem like any the counter parts have a unique KeyCode or KeyData. If I press the right or the left keys, I get the same KeyCode each time:
I've written a simple WAV player in VB 2010 - a Windows Form App with no menus. I'm trying to create a hotkey, like CTRL-D that would make a text box visible. Typing the correct password in the box will expand the form and show some Administrative functions. I'm having issues creating the hotkey with more than one key.I've got the following code, but it does not work. I do have KeyPreview set to True.
Private Sub _KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.KeyCode = Keys.Control And e.KeyCode = Keys.D Then txtPWD.Visible = True
I've also tried
If e.Keycode = Keys.ControlKey & e.KeyCode = Keys.D
and many other variations including changing to ALT and SHIFT but nothing seems to work. If I remove one of the Keys, it works just fine.
For example this textbox here: url...without clicking and selecting it. Just use a key ex: F5 to paste the text i copied to this any textbox or shoutbox?
how to get a keydown even to work but in 2010 this seems to have changed
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If e.Keycode = Keys.Enter Then MsgBox("test") End If End Sub
I am using the keydown event so that when i press the right arrow the image changes but when i run it nothing happens when i press the arrow key.I have enabled the keypreview Properties?
Private Sub Level1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If tmrWalk.Enabled = True Then Else If e.KeyCode = Windows.Forms.Keys.Right Then
Private Sub Form3_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown e.SuppressKeyPress = True 'makes it quit dinging when press enter
I have an application similar to calculator, with button from 0 to 9, Enter and Clear. I made it possible to use the buttons by clicking on them and also by using numpad, like shown below: Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Is it possible to set focus on the keydown event so after the button control, sets the focus into the keydown? although says often control can have focus,.Putting a button and a keydown event on a form...
I need to detect shift + arrow key in blank form. But it's not working. I also tried overriding IsInputKey method but it only detects single key press (like arrow key) but when multiple key are pressed it simply doesn't work.
If e.KeyCode = Keys.F1 Then DefaultSettingsToolStripMenuItem_Click(Me, EventArgs.Empty) ElseIf e.KeyCode = Keys.F2 Then
[Code]....
The problem is that when you press F1 - F4 or F9 nothing happens, am i using this code wrong? I have the code under the Form1_KeyUp section of the code.
So I opened 2 forms, Form2.vb and Form3.vbNow I put this:
Private Sub Form1_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown If e.KeyCode = Keys.F8 Then
How I can make this condition en VB.NET If e.KeyCode = [a-zA-Z0-9] Then End if I have understood that the Keycode are numbers but as I can do this validation with regex?
I am creating a setup project for my VB application. Everything seems to look fine. However when I tell it to build the solution I get the following error:Property 'keycode' is non-nullable. I have never seen this before in other setup projects and I can't find any help from MS.
I'm making a function that sends a string to a Handle using sendmessage , and I need to convert a Char to a virtual KeyCode. Asc and AscW returns ASCII code's which don't work.
I wrote this: Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown If e.KeyCode = Keys.Tab Then MsgBox("Tab") End If End Sub Why it doesn't work when I press tab on my keyboard?
I want to use e.KeyCode while form is minimized, I'm working on a screenshot-taker if you know what I mean. So Form1 is minimized > User presses F9 (Let's say the key is F9) > An event happens.
Does anyone know the global keycode for the windows key? I know that alt =1, control =2, and shift = 4. Also if you know the answer can you tell me where I can find the global keycodes?
I'm just trying to learn alot of the tricks and such so I'm making small programs and games to just get the swing of things.I'm having abit of trouble with this one, currently. I'm tying to create a form with two buttons. Now, I want to be able to press two keys on the keyboard and have one of the two buttons activate So, instead of clicking Button1, I pressed Control + C and it will say "Comment" and instead of clicking Button2, I press Control + U and it will say "Uncomment".
Public Class Form1
[code]...
The problem I keep running into is that the only way for the buttons to actually work is if they are already selected (Or, the last one clicked will work but the other will not). Then the keycode will work for them. How do I make this work without having to click on the button prior.
I tried to build my project but it has 1 build error :Property 'Keycode' is non-nullable. I double click it but it points nowhere. I'm really desperate. My project consists of Crystal Report. It had just been upgraded from version 8.5 to version 11. Is it possible that this is the source of error?
If e.KeyCode = Keys.D0 Or e.KeyCode = Keys.D1 Or e.KeyCode = Keys.D2 Or e.KeyCode = Keys.D3 Or e.KeyCode = Keys.D4 Or e.KeyCode = Keys.D5 Or e.KeyCode = Keys.D6 Or e.KeyCode = Keys.D7 Or e.KeyCode = Keys.D8 Or e.KeyCode = Keys.D9 Or e.KeyCode = Keys.Oemplus Then
[Code]....
The output WILL be 189 when I press the - sign. But when I check "Keys.OemMinus" it stands for 189 and when I replace "Keys.OemMinus" with 189 it won't work either!
I checked the Resources file and it's correct. The picture just doesnt change, only shows the last pressed button...