Validation of decimal numbers in textboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joashjoshua
    New Member
    • Apr 2007
    • 1

    #1

    Validation of decimal numbers in textboxes

    Hi,
    Newbie.. Would like to know how should I validate a decimal number in a textbox?
    tried IsNumeric but in vain does not recognise the decimal parts of it.

    Regards,
    Uday Padhye.
    9819025325
    (022)25476592.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by Joashjoshua
    Newbie.. Would like to know how should I validate a decimal number in a textbox?
    tried IsNumeric but in vain does not recognise the decimal parts of it.
    Can you show us the code? I have used IsNumeric (in VB6) and it handles decimals just fine.

    I created a new project with a single form, added a textbox and a command button, and inserted this
    Code:
    Private Sub Command1_Click()
      Debug.Print IsNumeric(Text1.Text)
    End Sub
    
    A few sample results...
    [U]Input   Output[/u]
    Text1   False
    123     True
    123.45  True
    Um... if the problem persists, try checking your Regional settings in Windows. Perhaps the decimal is different to what you (or VB) expect.

    Comment

    Working...