Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
545
WinGrid text search example
posted

I'am looking for a WinGrid text search example (C#).

I want to add a text search facility to my app.
The WinGrid control contains hierarchical data from a XML-file.

  • Is it possible to search through all cells?
  • Is it possible to search through cells in a certain column?

 

Parents
  • 69832
    Offline posted

    Example:

    private UltraGridRow SearchCells( string text, RowsCollection rows, UltraGridColumn column, StringComparison compareMethod )
    {
        foreach( UltraGridRow row in rows )
        {
            string cellText = row.GetCellText(column);
            if ( string.Equals(cellText, text, compareMethod) )
                return row;
        }

        return null;
    }

    UltraGridRow exposes methods (see HasChild, GetChild) which give you a way to get the child rows, so you could expand this method to call itself recursively when the row has children.

Reply Children