Numeric textbox

VB 2005 . How to make a textbox that allows the user to enter only double numbers


Answer this question

Numeric textbox

  • Dustin Walker

    Ok. How to make a textbox just like the one in windows calculator

  • HyperManiac

    Wrong answer. The right to left property doest have anything to do with the entered values and the allow only numeric values propertie doest exist in visual studio 2005

  • MartinBrasil

    Hi Kent,

    I just wanted to confirm that you shouldn't use RightToLeft property in the TB if you need to right-align your digits.
    This property is intended for right-to-left languages, like Arabic, Hebrew, Urdu and Farsi.

  • Aaron Skonnard

    Register an "Validating" event on TextBox and check in the eventHandler if the value entered is a double. If no, set eventarg "cancel" on true



  • fyllekai

    Thanks.

  • Niklas Borson

    I believe it's the way its done. Create a TextBox and set its RightToLeft property on Yes. Allow only numeric enter values (and ".")

  • kevikevtmc

    You want it to LOOK the same like the textbox in calculator - then you need RightToLeft property.
    Of course VS doesn't have "allow numeric values" property, you have to validate entered values yourself.

    So if you have VS 2005, so it's better you use MaskedTextBox control and properly set it's Mask-property.

  • Numeric textbox