+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Junior Member rajeshjm's Avatar
    Computer Details
    rajeshjm's Computer Details
    Operating System:
    Windos Xp
    Using
    Mechanical 2009
    Join Date
    Jul 2008
    Location
    India
    Posts
    12

    Default Range Validate in VBA

    Registered forum members do not see this ad.

    In my VBA code based on user input it has to execute the statement

    I need a code for this statement

    i created two text box. one for input and other for output

    If the input value is between 1 to 10 (it means the value may be 1 or 2 or 3 or 4 etc.....) then it need to show "A" in output

    similarly If the input value is between 11 to 20 then it need to show "B" in output

  2. #2
    Senior Member CmdrDuh's Avatar
    Computer Details
    CmdrDuh's Computer Details
    Computer:
    HP workstation xw8200
    RAM:
    2gig, soon to be 4
    Monitor:
    Dual 21s
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Location
    AZ, USA
    Posts
    396

    Default

    the simple way to do this is to restrict the textbox keypress to 0-9 only, then after pressed, read the value. THe problem you are going to have is if the user intends to press 12, when the 1 is pressed, textbox2 will display A, then when the 2 is pressed, it will change to B. What do you have so far?
    Everyone has a Photographic memory, some just don't have film

  3. #3
    Senior Member bsamc2000's Avatar
    Computer Details
    bsamc2000's Computer Details
    Operating System:
    Windows 7
    Computer:
    HP Z400
    CPU:
    Intel Xeon 2.66GHz
    Graphics:
    NVIDIA GeForce 9500 GT
    Monitor:
    E228WFP (2x)
    Using
    AutoCAD 2011
    Join Date
    Mar 2007
    Location
    Columbus, Ohio
    Posts
    120

    Default

    I have wrote a couple of programs that do this in VB .Net using "Regular Expressions". Do a quick Google search to see how to use them. You should be able to test for a wide variety of conditions. I use this alot to convert between units of measure.

  4. #4
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Registered forum members do not see this ad.

    Couldn't you use a if ?

    If > 0.5 and < 10.5 then do one
    If > 10.6 and < 20.5 then do two

    If lots of numbers use case, if only two < 10.5 or > 10.5

Similar Threads

  1. how do I constrain two faces to a range of motion?
    By geoffrey in forum Autodesk Inventor
    Replies: 0
    Last Post: 3rd Apr 2009, 04:32 pm
  2. Join-connect a range of points.
    By therock005 in forum AutoCAD General
    Replies: 12
    Last Post: 3rd Feb 2009, 05:26 am
  3. To define a range in the code
    By Hmm.. in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 8th Aug 2008, 09:08 am
  4. range of commands Help
    By BAD_WOLF in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 3rd Jun 2006, 06:12 am

Bookmarks

Posting Permissions

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