.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

SearchOptions.SearchBy Property

Gets or sets the direction of the search.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.1.Core.dll


public SearchBy SearchBy { get; set; }
Public Property SearchBy As SearchBy

Property Value

Type Description

One of the SearchBy enumeration values indicating whether to search by rows or by columns.


For more information about how to perform a search in the document, see Find and Replace.


The example below demonstrates how to perform a search with the specified options in the active worksheet and highlight all matching cells.

Dim worksheet As Worksheet = workbook.Worksheets(0)

' Specify the search term.
Dim searchString As String = Date.Today.ToString("d")

' Specify search options.
Dim options As New SearchOptions()
options.SearchBy = SearchBy.Columns
options.SearchIn = SearchIn.Values
options.MatchEntireCellContents = True

' Find all cells containing today's date and paint them light-green.
Dim searchResult As IEnumerable(Of Cell) = worksheet.Search(searchString, options)
For Each cell As Cell In searchResult
    cell.Fill.BackgroundColor = Color.LightGreen
Next cell
See Also