Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations 1

Status
Not open for further replies.

hilliolouis

Programmer
Jul 22, 2005
51
GB
How would I convert a string of a sum (e.g. 2+5) into its actual mathmatical answerv (e.g. 7). Just making a quick calculator app and I am stuck here. Any help appriciated

Louis Hill
 
The easiest way is to add a reference to the MSScriptControl (Microsoft Script Control 1.0 on the COM tab) and then do something like:

Code:
    [Blue]Dim[/Blue] sc [Blue]As[/Blue] [Blue]New[/Blue] MSScriptControl.ScriptControl
    sc.Language = [Red]"VBScript"[/Red]
    TextBox3.Text = sc.Eval(TextBox2.Text).ToString
    sc = [Blue]Nothing[/Blue]


Hope this helps.

[vampire][bat]
 
WOW

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top