True DBGrid for WinForms | ComponentOne
C1.Win.C1TrueDBGrid.4.5.2 Assembly / C1.Win.C1TrueDBGrid Namespace / C1DisplayColumn Class / GetFilterExpression Method
Example

In This Topic
    GetFilterExpression Method (C1DisplayColumn)
    In This Topic
    Gets the filter expression for the column.
    Syntax
    'Declaration
     
    Public Function GetFilterExpression() As System.String
    public System.string GetFilterExpression()

    Return Value

    The filter expression for the column
    Remarks
    Use this method in your implementations of custom filtering.
    Example
    Example shows how to build a row filter using GetFilterExpression method.
    ' raised when the filter changes
    Private Sub C1TrueDBGrid1_FilterChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.FilterChange
       ' build our filter expression
       Dim sb As New System.Text.StringBuilder()
                
       Dim dc As C1.Win.C1TrueDBGrid.C1DisplayColumn
                
       For Each dc In Me.C1TrueDBGrid1.Splits(0).DisplayColumns
         ' get the filter expression for the column
         Dim cond As String = dc.GetFilterExpression()
         If cond <> "" Then
           If sb.ToString() <> "" Then
             sb.Append(" AND ")
           End If
           sb.Append(cond)
         End If
                
      Next dc
      ' filter the data
      Me.DataSet11.Tables(0).DefaultView.RowFilter = sb.ToString()
    End Sub
    See Also