Conditionally Change a Control's Appearance
This document describes how to change a report control's appearance based on a specific condition.
Warning
Use the approach below if expression bindings are not enabled in the Report Designer (the Property Grid does not provide the Expressions tab ).
See Conditionally Change a Control's Appearance if expression bindings are enabled in the Report Designer (the Property Grid provides the Expressions tab).
Click the report's smart tag, and in the invoked actions list, click the Formatting Rule Sheet property's ellipsis button.
In the invoked Formatting Rule Sheet Editor, click the plus button to create a new formatting rule and click the Condition property's ellipsis button.
In the invoked Condition Editor, specify the required Boolean condition (which means that its result is either true or false).
Click OK to save the changes and close the dialog.
Back in the Formatting Rule Sheet Editor, define the formatting to be applied (e.g. specify the desired font color).
Click Close to save the changes and quit the dialog.
Select a required band or control to which the formatting rule should be applied and access its Formatting Rules collection.
In the invoked Formatting Rules Editor, move the rule to the list of active rules on the right using the arrow buttons in the center of the editor.
In this editor, you can also customize the precedence of formatting rules using the up and down arrow buttons on the right of the dialog box. The rules are applied in the same order that they appear in the list, and the last rule in the list has the highest priority.
Switch to Print Preview to view the resulting report.