TextBox OnKeyPress and delete (.Net 1.1)

  • Thread starter Thread starter Russell Hind
  • Start date Start date
R

Russell Hind

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
 
* Russell Hind said:
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.
 
Herfried said:
Check the 'KeyDown' event.

I've found that now. Thanks
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
 
Back
Top