Results 1 to 4 of 4

Thread: Equation

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2009
    Posts
    23

    Equation

    I know how to read user input using textbox but it only can read character and numbers. Is it possible that I want to read user input equation???
    Example:
    User type A+B
    User put range of A and B.
    1.25<A< 3.56
    2.45<B< 9.87

    I failed to read the equation using textbox. Is it there are other ways that can use to read equation input A+B???
    I am using VS2005 and VB.Net. I really new in this programming using VB.Net.

  2. #2

    Re: Equation

    You'd have to parse the equation in such a way that you would know what the user could put in. I'm not really sure how that would work, but for the addition..you can just do an If statement to see if there's a "+", if so, split the text on the "+", and take the two numbers (that will come in a String Array), Double.TryParse() them, and then add them up.

  3. #3
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Equation

    expressions evaluation is a three-staged process:
    1. Parsing and tokenizing (splitting user input into parts called tokens)
    2. Converting the expression from Infix into Postfix notation.
    3. PostFix Evaluation.

    I have my own expression evaluator which understands even some math and sting functions, supports 4 primitive data types including string. But I have abandoned it and didn't implement the support for variables and arrays.
    If you're interested in some details - PM me.

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Equation

    This link shows it in action

    http://www.chris-j.co.uk/parsing.php
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width