CrystalReportViewer.SelectionFormula Property

Gets or sets the record selection formula of the report.

Namespace CrystalDecisions.Windows.Forms Assembly CrystalDecisions.Windows.Forms (CrystalDecisions.Windows.Forms.dll)

Syntax

'Declaration

Public NotInheritable Property SelectionFormula As String
public sealed string SelectionFormula {get; set;}

Example

This example shows how to set the SelectionFormula property for the report.

'Declaration

    Private Sub SetSelectionFormula(ByVal mySalesAmount As String, ByVal myCustomerName As String)
      Dim mySelectionFormula As String = "{Customer.Last Year's Sales} > " & mySalesAmount _
      & " AND Mid({Customer.Customer Name}, 1) > """ & myCustomerName & """"
      CrystalReportViewer.SelectionFormula = mySelectionFormula
    End Sub
    private void SetSelectionFormula(String salesAmount, String customerName)
    {
      String selectionFormula = "{Customer.Last Year's Sales} > " + salesAmount
        + " AND Mid({Customer.Customer Name}, 1) > \"" + customerName + "\"";
      crystalReportViewer.SelectionFormula = selectionFormula;
    }

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

CrystalReportViewer Class
CrystalReportViewer Members
CrystalDecisions.Windows.Forms Namespace