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

winforms: handling enter key for single line edit?

I want to take an action when the user hits the enter key on a single line
edit on the form but I can't find any events that handle the enter key. The
char and keyup events still cause a beep on the carriage return although it
sends the linefeed char. I'm sure there is a better way to accomplish this?
Nov 16 '05 #1
3 2463
nevermind, I got it

protected override bool ProcessDialogKey(Keys keyData)
{
if(keyData == Keys.Enter && QuizAnswerTextBox.Focused==true)
{
QuizAnswerTextBox.Text = "";
return true;
}
return base.ProcessDialogKey (keyData);
}

"PEACEMAKER" <do**********@yo.mamas.hairy.ass.com> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
I want to take an action when the user hits the enter key on a single line
edit on the form but I can't find any events that handle the enter key. The char and keyup events still cause a beep on the carriage return although it sends the linefeed char. I'm sure there is a better way to accomplish this?

Nov 16 '05 #2
Hi PEACEMAKER,

You could also catch it if you handle the keydown event for the form while
setting KeyPreview to true.

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Hi PEACEMAKER,

You could also catch it if you handle the keydown event for the form while
setting KeyPreview to true.

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #4

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

Similar topics

7
by: Ori | last post by:
Hi, I would like to create some mechanism to handle all the exceptions which will happen in my application. I have one form which is the base form while all the other forms inherit from it. ...
1
by: PEACEMAKER | last post by:
I want to take an action when the user hits the enter key on a single line edit on the form but I can't find any events that handle the enter key. The char and keyup events still cause a beep on...
9
by: Nate Hekman | last post by:
As I've mentioned a couple of times in the last few minutes(!), I've got a simple form with an edit box and a Submit button. If I type something in the Edit box and hit Enter I hear a click but...
0
by: M. Genuini | last post by:
Hi all, i'm a reader of this NG from a long time and i should say that it was really useful in my learning process on c#. Now i'm writing a family of WinForms that should be used by a...
11
by: Steve Smith | last post by:
I have written a winforms application that launches approximately 150 threads with Thread.ThreadStart() Each thread uses CDO 1.21 to logon to a different Exchange mailbox and send/receive a...
5
by: brian.wilson4 | last post by:
Our group is currently comparing winforms vs webforms.....app is Corp LAN based - we have control of desktops.....Below is pros and cons list we have come up with - if anything strikes you as...
12
by: sam | last post by:
hi all, i'm starting to put together a program to simulate the performance of an investment portfolio in a monte carlo manner doing x thousand iterations and extracting data from the results. ...
0
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
4
by: Andrus | last post by:
For winforms application with multiple related forms it is reasonable to create Linq database context object in start of application. Context object is released only when application exits. So...
10
by: Descartes | last post by:
Dear All, Coming from another development environment, it appears that I bang my head in the wall on very basic matters, so I hope you can give me a push in the right direction. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.