Solved 2.0 Winforms: textbox bound to an integer database field doesn't accept text, yet no user error thrown?

Posted on 2006-03-31
Last Modified: 2009-07-29
Textboxes bound to integers 'trap' the cursor if A-Z are entered....
I'd like to make this more user friendly!


I'm building a simple data entry form in 2.0

I have a bunch of bound textboxes.

to my delight, the textboxes bound to numeric fields in the database seem to have some nice functionality - although they'll take A-Z, you can't leave the field if those values are present.

There's no beep, no little red circle, nothing!

I assume this is a 'feature' in .net, I'd like to know how to 'enhance' the feature, by letting a user know WHY they are 'trapped' in the field.
Question by:fruhj
    LVL 52

    Accepted Solution

    Theres no little red circle because you presumably don't have a range validator control on your form linked to the textbox. Try adding one, you can specify that only numbers are allowed and define a message to be displayed if the input is invalid.

    Alternatively you can manually validate the data using the KeyPress or Validating events for the control.
    LVL 12

    Author Comment

    Sorry about missing this,

    Started a new contract with no access to EE :-(

    Carl thanks for replying!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now