Number Textbox

J

Jared

Hi,

I have decided the best way to prevent characters from data entry is to use
numericupdown control.

The only problem is I need way to hide the updown control....wish there was
a property for this.

Anyone now easy way to get rid of updown arrows.

Thanks
Jared
 
M

Morten Wennevik

Jared

Simply process the KeyPress event and ignore entries that does not comply
with Char.IsDigit or Char.IsControl.
 
M

Morten Wennevik

If you only test for Char.IsDigit only numbers will be accepted, but then
backspace would not work, even though delete does. This is solved by also
testing for Char.IsControl.
 
C

Claes Bergefall

If you set the ES_NUMBER style (as shown in the code I posted) you don't
need to worry about IsDigit, IsControl or KeyPress

/claes

If you only test for Char.IsDigit only numbers will be accepted, but then
backspace would not work, even though delete does. This is solved by also
testing for Char.IsControl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top