Eval for VB

Eval

Power up your apps with math skills!

Eval is an expression evaluator module and math parser for Visual Basic 6.0. It evaluates almost any VB6 expression. You can accept expressions from users and calculate the result with a simple call.

Just one function call is required:

Evaluate(Expression)
Use it to add calculation capabilities to your programs. For example, Evaluate("7+2^3") returns 15. Here are a few examples of what you application might do:

  • Calculate a simple mathematical formula like "1+2+3".
  • Accept any formula like "x + y^2", substitute variable values and get the result.
  • Draw curves from user-defined formulas.
  • Build your own calculator.
  • Add expressions to your own programming language or macro system.

Eval is simple to use. Here is an example.

Formula = Textbox.Text     ' Accept input from the user, example: "1+2+3"
Result = Evaluate(Formula) ' Result will be 6

Supported expressions

Eval can handle all Visual Basic constant expressions:

  • Numbers (decimal, octal, hexa) and string literals
  • Numeric operators: all arithmetic, comparison and logical operators (+ - * / \ ^ Mod, etc.)
  • String concatenation and Like
  • The keywords Empty and Null
  • Basic single-argument functions like CInt(), Abs() or Sgn()

Eval contains an easy interface to support variables. You can also extend the module by adding more functions.

Module information

Compatible with VB5, VB6 and VBCE. Eval comes as an ordinary source code module (Eval.bas) for Visual Basic 5.0 and 6.0. There is also a legacy version for VBCE 6.0. VB.NET support is not available.

No run-time files required. Eval doesn't require any run-time files or any specific Windows version. We all know the problems with the distribution of run-time files: missing files, wrong versions... Eval doesn't suffer from these problems. Eval is just a normal .bas module, or maybe two.

Latest update (v1.02, 2013): Documentation update. Help file format changed from .hlp to .chm. No changes in functionality.

Try Eval now!

Download a demo and see the capabilities of Eval. The demo is a compiled program that lets you type in expressions and view the results. The demo requires VB6 run-times.

Eval is being used in several commercial applications, including Project Analyzer and VB Watch.

©Aivosto Oy -