Spread Windows Forms 11.0 Product Documentation
Searching for Data with Code
Spread Windows Forms 11.0 Product Documentation > Developer's Guide > Customizing Sheet Interaction > Customizing User Searching of Data > Searching for Data with Code

To search for data in any of the cells of a sheet, use any of these sets of methods in the FpSpread class:

The parameters of the various search methods allow you to specify the sheet to search, the string for which to search, and the matching criteria. For a list of qualifications (restrictions) of the search, refer to the set of methods listed above for more details.

Most searches (except for the method that specifies a block range of cells) start at the specified start cell and continue to the end of the row and then start the next row at the first cell. The search continues until either the end cell or the end of the sheet.

For information about the search dialogs, refer to Allowing the User to Perform a Standard Search and Allowing the User to Perform an Advanced Search.

Using Code

Use the Search method for the Spread component to perform a search.

Example

This example uses the Search method for the Spread component to perform an exact-match search on the third sheet (Sheet 2) for the word "Total" and return the values of the row index and column index of the found cell.

C#
Copy Code
int rowindx = 0;
int colindx = 0;
fpSpread1.Search(2,"Total",true,true,false,false,1,1,56,56, ref rowindx,ref colindx);
VB
Copy Code
Dim rowindx as Integer
Dim colindx as Integer
fpSpread1.Search(2,"Total",True,True,False,False,1,1,56,56,rowindx,colindx)