Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

What does the KeyPressEventsArgs handle property do?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rsine - 28 Feb 2006 13:53 GMT
I am trying to understand exactly what the handle property of the
KeyPressEventsArgs does.  I thought I could set it to false to prevent
a key from being included into a textbox.  For example, if I wanted
only numbers in my textbox and the user pressed an alpha character key,
then I would set the handle property to false and it would be as if the
KeyPress event never occurred thus negating the keystroke.  However,
what I am seeing is the pressed key still ends up in my textbox.  I
read on MSDN that if the handle is set to false, the operating system
uses a default process to handle the event which is what I figure is
putting the keystroke into the textbox.  Is this true or am I
misreading what happens?  If it is true, what does setting the handle
property to false actually do?

-Thanks
Stoitcho Goutsev (100) - 28 Feb 2006 14:09 GMT
rsine,

You almost got it. You need to set the Handled (past tense) property to
*true* if you want to indicate that you have processed the keypress and you
don't want the framework to do its default processing - putting the
character into the textbox.

Signature

HTH
Stoitcho Goutsev (100)

>I am trying to understand exactly what the handle property of the
> KeyPressEventsArgs does.  I thought I could set it to false to prevent
[quoted text clipped - 10 lines]
>
> -Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.