473,322 Members | 1,566 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,322 software developers and data experts.

Making a Form read keyboard input

Hi,
I've been trying to write a small windows application in C#. I want the
form to read special input sequences act accordingly. For example,
<Alt><Ctrl>H should bring up the help box etc. I tried to use the
form1_keydown event, but that doesn't seem to work.

What can be done to make it work?

Thanks in advance.

--ts

Nov 13 '06 #1
2 4138
You need to set the KeyPreview property on the form to true. This will make
it fire the Key events when it is activated.
Then you should be able to handle it as you planned.

Ciaran O'Donnell

"Srin" wrote:
Hi,
I've been trying to write a small windows application in C#. I want the
form to read special input sequences act accordingly. For example,
<Alt><Ctrl>H should bring up the help box etc. I tried to use the
form1_keydown event, but that doesn't seem to work.

What can be done to make it work?

Thanks in advance.

--ts

Nov 13 '06 #2
Ciaran O''Donnell wrote:
You need to set the KeyPreview property on the form to true. This will make
it fire the Key events when it is activated.
Then you should be able to handle it as you planned.

Ciaran O'Donnell

"Srin" wrote:
Hi,
I've been trying to write a small windows application in C#. I want the
form to read special input sequences act accordingly. For example,
<Alt><Ctrl>H should bring up the help box etc. I tried to use the
form1_keydown event, but that doesn't seem to work.

What can be done to make it work?

Thanks in advance.

--ts
Thank you Ciaran, that worked.

Nov 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: j. del | last post by:
I am just beginning to write programs... and my first task that I have set myself is to write a little program that will generate cryptic bywords from a source of text. A cryptic byword is...
8
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
2
by: Rajen | last post by:
Suppose the field length is 25 characters. After entering the 25th character, it should be available to process. Program should not wait for the user to press enter/return key. Thank you.
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
1
by: pinkfloydhomer | last post by:
I am writing a curses application, but the getch() does not seem to give me all I want. Of course, if I press "d", it returns an ord("d") and so on. But I want to be able to detect whether alt,...
5
by: bmerlover | last post by:
I currently have a gui app I programmed with visual c++ .net version. Is there any way I can read any character from the keyboard as soon as any key is pressed while the application is running? My...
6
by: Steve | last post by:
Hi All I have an on-screen keyboard within a POS program I have written in VB.net 2005, for touch screen computers I have it set to 'always on top' so the user can move the cursor to...
7
by: ManWithNoName | last post by:
If you have a form with x input and two or more buttons, how do you control which button has preceding when the user hits the keyboard key "enter"? Currently it seems to be determined in a...
5
by: MikeB | last post by:
I have a simple form that I'm using to learn something about HTML and JavaScript. Can I associate a button on the form with a keyboard key so that when the user presses the keyboard key the form...
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...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.