validate integer and decimal

Posted on 2010-01-07
Last Modified: 2012-05-08
Hi experts
Could someone show me how to validate a number in a textbox to ensure that it is either an integer, or a decimal number with 2 places to the right of the decimal point.
Question by:dizzycat
    1 Comment
    LVL 11

    Accepted Solution

    if isnumeric(txt1.value) then
    'its a number
      if indexOf(txt1.value,'.') > 0 then
         if txt1.value.substring(indexOf(txt1.value,'.')+1,len(txt1.value)-indexOf(txt1.value,'.')).length =2 then
           'number with 2 decimal places
         end if
      end if
    end if

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 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

    20 Experts available now in Live!

    Get 1:1 Help Now