Results 1 to 5 of 5

Thread: [RESOLVED] How make a textbox numeric?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    6

    Resolved [RESOLVED] How make a textbox numeric?

    Hi,

    could you please help me with this one: How do I make a textbox numeric? And also, how do I format the text length? I.e. I want the user to input numbers with maximum 2 digits only.

  2. #2
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: How make a textbox numeric?

    Using a NumericUpDown box instead is probably easier. You can set the max/min, number of d.p.s and it only accepts numbers
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    6

    Re: How make a textbox numeric?

    Thanks, very good! I was not aware of this control.

    While we're at it, do you know if it is possible to make a textbox numeric?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How make a textbox numeric?

    This question has been asked and answered numerous times, so a forum search should give you plenty of information. The best implementation of a numeric TextBox I've seen is the NumberBox in the WFC library in my signature. It's pretty easy to handle KeyPress events to handle the majority of situations but, as always, the devil is in the detail. It becomes tricky to handle the less common sets of circumstances, but you've still got to account fopr those circumstances because if there's a way to break your app then users will find it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    6

    Resolved Re: How make a textbox numeric?

    Nice! I downloaded NumberBox and it is working fine!

    Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width