Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Evaluate an expression using the Microsoft Script Control

Total Hit ( 3697)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


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:

Click here to copy the following block
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 espr As String = "12 + 3 * 10"
Dim res As Double = sc.Eval(expr)

' display the result
Console.WriteLine("{0} = {1}", expr, res)


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.