Embedded VB.NET expressions

Visual Basic.NET (VB.NET) is an easy-to-use programming language developed by Microsoft. variaDoc allows you to use VB.NET expressions to perform special tasks like calculations and formatting.
VB expressions can be embedded in any expression. To embed a VB.NET expression in an expression use an accolade pair like this:
Total amount due is { $[orders:subtotal] + $[orders:freight] }
This expression demonstrates how two data references can be added together. The resulting value is turned into text and appended to the static text, resulting in something like this:
Total amount due is 99.95

Using the .NET framework

variaDoc runs on the Microsoft .NET framework. VB.NET expressions provide you access to the .NET framework, and have all classes in the .NET System assembly at their disposal. Among these classes is the very powerful System.String class, which will be discussed later.
You also have access to basic system services such as the application environment (System.Environment) and networking (System.Net).
For example, to get the current date and time you can use DateTime.Now, like so:
{ DateTime.Now }
This expression will evaluate to the full date and time, like in the example below:
8/24/2004 5:55:34 PM


VB.NET expressions are limited in several ways:
  1. Compound statements such as if/then/else, for each etc. are not supported.
  2. Variables are not supported.
  3. Each expression must evaluate to a value.
  4. Only the following namespaces of the .NET framework are accessible: System, System.Math, System.Web, Microsoft.VisualBasic.
Within these limitations anything is possible, including complex calculations and data formatting.