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

How to Handle 'enter' key in a form

i had designed a win app(an address book)

when the user wants to enter the contact he will type in all the
details and "HE SHOULD CLICK ON THE ADDENTRY BUTTON PROVIDED"

i want to simplify this task for the user by allowing the data to bw
added in database when "HE PRESSED ENTER KEY AFTER ENTERING THE
DETAILS"

how can make a button as default button and that button is should be
activated when we press the ENTER key from keyboard

Jun 8 '07 #1
2 4680
A 'System.Windows.Forms.Form' has a property 'AcceptButton'. In the
designer, the property value selection for 'AcceptButton' allows you
to pick any of the buttons on the form. Related you also have a
'CancelButton' property.

Alternatively, you can add an event-handler for the 'KeyDown' or
'KeyPress' events. The argument is of type
'System.Windows.Forms.KeyEventArgs' and thus will tell you what button
(for example: 'enter') was pressed.

Jun 8 '07 #2
Hi,

Take a look at Form.ProcessCmdKey

"sravan_reddy001" <sr*************@gmail.comwrote in message
news:11**********************@o11g2000prd.googlegr oups.com...
>i had designed a win app(an address book)

when the user wants to enter the contact he will type in all the
details and "HE SHOULD CLICK ON THE ADDENTRY BUTTON PROVIDED"

i want to simplify this task for the user by allowing the data to bw
added in database when "HE PRESSED ENTER KEY AFTER ENTERING THE
DETAILS"

how can make a button as default button and that button is should be
activated when we press the ENTER key from keyboard

Jun 8 '07 #3

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

Similar topics

5
by: Danny | last post by:
Does anybody have a nice method of forcing a user to enter a value into a form using asp? I think the best is to have a popup when they hit submit that will stay on the same page and then just...
1
by: chuck | last post by:
Hello, I have to create a complex form to handle company product returns. Right now, I have some form fields to describe the product being returned, productID, productDES,ProductQTY. Thats fine. ...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
5
by: MLH | last post by:
I get error 3315 when attempting to enter ZLS into a text-type table field whose allow zls property is set to false. The error says "Field MyTable.MyField can't be a zero-length string" For...
3
by: Coder | last post by:
hi, there is still no answer, i wonder if there is a way to handle the multiple key-press event on a C# windows form, like "Ctrl+Enter"
2
by: Nick Gilbert | last post by:
Hi I have a number of pages where it is valid for the user to enter HTML. On these pages, I have turned off RequestValidation ("ValidateRequest = false" in the page directive) so that the...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
1
by: kgerritsen | last post by:
I am building an application that will receive input from a barcode scanner. The barcode scanner is configured to append to the front value a single character and hyphen that identify the barcode...
3
by: chris52672 | last post by:
If I have text box 1 (Password Enter) and I have text box 2 (Password Reneter). After text has been entered in text box 1 and the enter key is pressed to make text box 2 active (the curser will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.