Share via


Expression Dialog Box (Visual Studio Report Designer)

Use the Expression dialog box to write an expression. The Expression dialog box includes a Code window, a category tree, category items, and a Description pane. You can open the Expression dialog box for the following items:

  • A text box on a report.

  • A property in the Properties window.

You can open the Expression dialog box by right-clicking a text box or by choosing <expression> in the values list of a property. You can use expressions to set many properties, including color, font, and borders, to name a few.

The Expression dialog box is context-sensitive; the category items and descriptions change in response to the expression category you are working with. It supports IntelliSense, statement completions, and syntax coloring so that you can easily detect syntax errors. You can move and resize the Expression dialog box if you want a larger work surface.

Expression Constructs

The expressions you create can include constants, global values, fields, and other elements. The following list describes the categories and parts of an expression.

  • Constants
    Select the Constants node to define expressions that include a constant value. Constants are used to specify color, font, and enumerators.

    Not all report items will support expressions that can be set to a constant. If a property cannot be set to constant value, the description provides this information.

  • Globals
    Provides a list of the items in the global collection that you can use in an expression.
  • Parameters
    Provides a list of report parameters.
  • Fields
    Displays a list of fields that can be used in the expression. The list varies depending on the property. Double-click a field to copy the field to the Expression box. Alternatively, you can drag a field to the Expression box.
  • Datasets
    Provides a list of available datasets and shows the fields that are members of the dataset.
  • Operators
    Displays the operators you can include in a calculation or string manipulation.
  • Common Functions
    Displays common functions, grouped by type (for example, text, date & time, and so on).

Options

  • Code window
    Use the Code window in the top pane to type an expression. When you open the Expression dialog box, the Code window contains the current expression. You can replace or revise the expression or paste in functions, operators, constants, fields, parameters, and items from the global collections. The Code window reflects your modifications.
  • Category tree
    Displays categories of expressions. Choosing a category establishes a context for creating an expression. For example, selecting Aggregate functions displays AVG, Count, and other aggregate functions that you can incorporate into the expression.
  • Descriptions, samples, or member list
    Depending on the category item you select, the third pane contains a description, a sample expression, or a list of members.

See Also

Concepts

Adding Custom Code to a Report (Visual Studio Report Designer)
Global Collections for Expressions in Reports (Visual Studio Report Designer)
Common Expressions for Reports (Visual Studio Report Designer)
Built-in Functions for Reports (Visual Studio Report Designer)
Using Expressions in a Report (Visual Studio Report Designer)
ReportViewer Controls (Visual Studio)
ReportViewer Web Server and Windows Forms Controls

Other Resources

Report Designer User Interface Reference (Visual Studio)