Creating a numeric-only textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi! I'm trying to subclass a TextBox and make it so only numeric characters
may be entered. I thought the easiest way would be to override the
"OnKeyPress" method, check the data, and set the character to 0 if invalid
(this worked in eVb!!!). But, it looks like this is a no-go because the
character is readonly. Any ideas on how I can restrict non-numeric
characters?
 
Wouldn't you know it, the solution was right in front of my face...so THATS
what the "Handled" property is for! Thanks for the help, I'm kinda new to
this .Net stuff!
 

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

Back
Top