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 / July 2004

Tip: Looking for answers? Try searching our database.

TextBox OnKeyPress and delete (.Net 1.1)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Russell Hind - 26 Jul 2004 11:05 GMT
The OnKeyPress event doesn't fire if the Key is 'delete' (it fires for
backspace).

How are you supposed to validate text entry as they type if keys that
can change the contents don't fire the event?

Is there a way to either disable delete or force it to fire the KeyPress
event?

Thanks

Russell
Herfried K. Wagner [MVP] - 26 Jul 2004 12:28 GMT
* Russell Hind <no-one@no-where.com> scripsit:
> The OnKeyPress event doesn't fire if the Key is 'delete' (it fires for
> backspace).

Check the 'KeyDown' event.

> How are you supposed to validate text entry as they type if keys that
> can change the contents don't fire the event?

The text should be validated in the control's 'Validating' event.

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/

Russell Hind - 26 Jul 2004 12:59 GMT
> * Russell Hind <no-one@no-where.com> scripsit:
>
>>The OnKeyPress event doesn't fire if the Key is 'delete' (it fires for
>>backspace).
>
> Check the 'KeyDown' event.

I've found that now.  Thanks

>>How are you supposed to validate text entry as they type if keys that
>>can change the contents don't fire the event?
>
> The text should be validated in the control's 'Validating' event.

I'll have a look at it, but at the moment I have a simple wrapper class
that can wrap both Borland's VCL controls and .Net classes to give me a
common, standard C++ interface to UI elements, and the VCL doesn't have
a validating method so I've already got code that worked with OnKeyPress
(just never realised that OnKeyPress didn't fire with delete but I
understand now why not).

I code simulate Validating in VCL but its all working for now.

Thanks

Russell

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.