dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB7
Expertise: Intermediate
Jul 6, 2002

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Evaluate an expression using the Microsoft Script Control

Thanks to COM Interop, you can still use the Microsoft Script Control from VB.NET and any other .NET language. To do so, you must add a reference to the Microsoft Script Control library (from the COM page in the Add Reference dialog box): this action creates a new reference named Interop.MSScriptControl, which enables you to use the Script control with early binding. The following code uses the Eval method to evaluate a math expression from VB.NET:

Dim sc As New MSScriptControl.ScriptControl()
' You always need to initialize a language engine
sc.Language = "VBScript"
' this is the expression - in a real program it will probably be
' read from a textbox control 
Dim expr As String = "12 + 3 * 10"
Dim res As Double = sc.Eval(expr)

' display the result
Console.WriteLine("{0} = {1}", expr, res)
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date