Click here to Skip to main content
15,040,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I'm just start implementing winform which integrate with usb keyboard. I try to search on the internet but I don't found any success keyboard input.

If you guys have suggestion, I need guide for complete build app integrate with USB keyboard which start from import,declaring and keydown value. I wish someone could provide me a link to the guideline. Maybe I'm wrong in searching a wording in search engine. TQ

additional information copied from comment below
I apologize for making a confuse question here. Actually I create a simple program using WinForm for VB.net 2010 which when I press a certain key on keyboard, it will perform action such as refresh listview(F5),cancel input (Esc),saving (Ctrl+S) and so on. I guest this integrate mean I need to specify which key is press to perform specific action as stated before. I assume that I will perform all those function using keyboard not by mouse to click. I dont want to use the Alt + XXXX where I can put it on the button function with the _ on the character (if you got what I mean)
Posted
Updated 18-Nov-13 22:50pm
v2
Comments
Zoltán Zörgő 19-Nov-13 3:24am
   
Whooo... Slowly. You either want some low level stuff, or your question makes no sense at all. What do you mean by integrating with keyboard? A keyboard is a system level device and it is working as input for any windows forms application by default. So please clarify! Key_Down event should work (see: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keydown(v=vs.110).aspx), it is not working or you want a system level keyboard hook or what?
Luiey Ichigo 19-Nov-13 4:10am
   
Hi Zoltan,

I apologize for making a confuse question here. Actually I create a simple program using WinForm for VB.net 2010 which when I press a certain key on keyboard, it will perform action such as refresh listview(F5),cancel input (Esc),saving (Ctrl+S) and so on. I guest this integrate mean I need to specify which key is press to perform specific action as stated before. I assume that I will perform all those function using keyboard not by mouse to click. I dont want to use the Alt + XXXX where I can put it on the button function with the _ on the character (if you got what I mean)

Assuming that the keyboard is a standard device, then it needs no work on your part at all, unless you want to capture some keystroke combinations and use them as "hotkeys" in your application.
A keyboard is handled by the OS and just passes data through via the normal events, regardless of whether it is PS/" or USB, and regardless of whether you have one, two or seven physical keyboards plugged in. I have often had two keyboards connected at the same time (for different layout/languages) and it all works exactly as you would expect - seamlessly.
   
So you want simple shortcuts.
First of all, if you use buttons shortcut availability is default. Simply put an amp in the text: Button1.Text = "&Ok"; , and you have Alt+O as shortcut (but you don't want this for some reason). With menus, you have even more possibilities, see here: http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.shortcut(v=vs.110).aspx[^]. If you want to have more general approach to be able to add custom shortcuts to custom actions, you can have a look here: http://snipplr.com/view/57156/[^].
   
v2
Comments
Luiey Ichigo 28-Nov-13 22:58pm
   
Hi Zoltan,

Sorry to make you misunderstanding. I want to create a program that can replace button to perform action. Let's say user key in an ID on textboxt1. User will click on button Enter to perform searching. I want user to press Enter on keyboard so when it perform, I will detect user press that Enter key and I will perform search.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900