SearchRow Method
Applies To
fpSpread control
Description
Searches a row for a specified value or string.
Syntax
long CSpreadSheet::SearchRow(long lRow, long lColStart, long lColEnd, LPCTSTR Text, long SearchFlags);
fpSpread1.SearchRow(ByVal lRow As Long, ByVal lColStart As Long, ByVal lColEnd As Long, ByVal Text As String, ByVal SearchFlags As SearchFlagsConstants) As Long
Parameters
The following parameters are available:
Parameter | Description | ||
---|---|---|---|
lRow | Row in which to search | ||
lColStart | Column at which to begin searching (column is not included in search) | ||
lColEnd | Column at which to end searching Set to –1 to search all columns. |
||
Text | Text for which to search Set to an empty string ("") to search for empty cells. |
||
SearchFlags | Specify how the search is performed Use the Or operator and combine the following values as indicated: |
||
Value | Constant | Description | |
0 | SearchFlagsNone | Searches for exact match to complete text in cell, but ignores cases | |
1 | SearchFlagsGreaterOrEqual | Search for text or a value greater than or equal to the specified text or value | |
2 | SearchFlagsPartialMatch | Search for text that matches or partially matches the specified text | |
4 | SearchFlagsValue | Searches for text as if the text provided is equivalent to using the Value property | |
8 | SearchFlagsCaseSensitive | Search for text that exactly matches the text and case specified | |
Use one of the following values: | |||
16 | SearchFlagsSortedAscending | Use for searching in columns that are sorted in ascending order. The method works more rapidly on a sorted column if you specify this setting. | |
32 | SearchFlagsSortedDescending | Use for searching in columns that are sorted in descending order. The method works more rapidly on a sorted column if you specify this setting. |
Remarks
Use the SearchRow method to search for specified text or values in a row. To search for each occurrence of the text or value, call the SearchRow method and set the lColStart parameter to –1. Then, call the SearchRow method again, specifying the returned column from the previous call as the value of the lColStart parameter for each succeeding call. When the method returns –1, you have returned all occurrences of the text or value.
Note: Row headers are not searched. |
This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.
Setting 4 (SearchFlagsValue) for the SearchFlags parameter lets you search for a value using the unformatted value of the data. For example, suppose the sheet had a currency value such as "i 4,451,493.00" in a cell. If you wanted to search for the unformatted value, 4451493.00, you could specify that unformatted value as the search string, and set the SearchFlags parameter to SearchFlagsValue to find the currency value without specifying any formatting. This might be useful if you are unsure of the currency symbol or some other formatting character that will be used in the data.
Use the SearchCol method to search for text or a value in a particular column.
Return Type
Number of column containing the search text. Returns –1 if search text is not found.
See Also
SearchCol method
DLL Correspondence
SSSearchRow function