C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-27-2005, 01:39 AM   #1
mustang benny
 
bennyandthejets's Avatar
 
Join Date: Jul 2002
Posts: 1,401
Want to stop single-line text control beeping at me

The text control needs to be single line, and I've captured the KeyPress event for when Enter is pressed. This works fine, but the control beeps whenever Enter is pressed, even if I capture KeyDown as well. Is there a way to stop this behavior?
__________________
benforbes@optusnet.com.au
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro

Code Tags
Programming FAQ
Tutorials
bennyandthejets is offline   Reply With Quote
Old 03-27-2005, 09:44 AM   #2
BMJ
Registered User
 
Join Date: Aug 2002
Posts: 1,330
Try this.
Code:
protected override bool ProcessDialogKey(System.Windows.Forms.Keys keyData)
{
    if (keyData == System.Windows.Forms.Keys.Enter)
        return true;

    return base.ProcessDialogKey(keyData);
}
BMJ is offline   Reply With Quote
Old 03-27-2005, 08:18 PM   #3
mustang benny
 
bennyandthejets's Avatar
 
Join Date: Jul 2002
Posts: 1,401
Works great, thanks. Can it be done without overriding a function?
__________________
benforbes@optusnet.com.au
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro

Code Tags
Programming FAQ
Tutorials
bennyandthejets is offline   Reply With Quote
Old 03-28-2005, 03:48 PM   #4
BMJ
Registered User
 
Join Date: Aug 2002
Posts: 1,330
Not with version 1.x of the Framework, however with version 2.0 this isn't a problem.
BMJ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading text file by line number whiskedaway C++ Programming 13 06-16-2009 10:09 AM
reading a text file printing line number bazzano C Programming 4 09-16-2005 10:31 AM
Validating the contents of a char buffer mattz C Programming 3 12-09-2001 06:21 PM
inputting line of text vs. integers in STACK sballew C Programming 17 11-27-2001 11:23 PM
text line termination Unregistered C Programming 3 09-09-2001 04:39 AM


All times are GMT -6. The time now is 08:03 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22