Results 1 to 5 of 5

Thread: Calculation on a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    5

    Calculation on a string

    I have to display te resul of a simple math operation entered as string
    example
    input="22+2*3"
    output display=28
    Anybody knows how

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Calculation on a string



    you could parse it manually, or

    you could add a Microsoft Script Control to your form and then just do:
    VB Code:
    1. MsgBox ScriptControl1.Eval("22+2*3")

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    5

    Re: Calculation on a string

    the problem is it needs to be display as a object in the form

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Calculation on a string

    eh? the control just does he calculating, you can assign to result to whatever you like:
    VB Code:
    1. Label1.Caption = ScriptControl1.Eval("22+2*3")

  5. #5
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    UK
    Posts
    417

    Re: Calculation on a string

    hi Check the zip I included it do what you want without depending on other control all code commeneted, supports all Math operators variables brackets, Functions and more.
    Attached Files Attached Files
    When your dreams come true.
    On error resume pulling hair out.

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