CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Posts
    60

    Question "((3+5)*4)-(40/2)-10)" =????

    When user enter any string on TextBox like... "((3+5)*4)-(40/2)-10)".
    how to make my program give the numerical result from the string.

  2. #2
    Join Date
    Feb 2002
    Location
    Makati City, Philippines
    Posts
    1,054
    Add 'Microsoft Access 8.0 Object Library' to your project's reference and this code:
    Code:
    private Sub Command1_Click()
      Text1.Text = "((3+5)*4)-(40/2)-10)"
      MsgBox Eval(Text1.Text)
    End Sub
    Marketing our skills - please participate in the survey and share your insights
    -

  3. #3
    Join Date
    Sep 2001
    Location
    IL, USA
    Posts
    1,090
    Code:
    'Add the Microsoft Script Control to your form and use the Eval function.
    private Sub Command1_Click()
    Debug.print ScriptControl1.Eval(Text1)
    End Sub

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

Featured