Spread Silverlight Documentation
Search(String,SearchFlags,SearchOrder,SearchFoundFlags,SheetArea,Int32,Int32,Int32,Int32,Int32,Int32,String) Method
Example 


GrapeCity.Windows.SpreadSheet.Data Namespace > Worksheet Class > Search Method : Search(String,SearchFlags,SearchOrder,SearchFoundFlags,SheetArea,Int32,Int32,Int32,Int32,Int32,Int32,String) Method
The string for which to search.
The SearchFlags enumeration that specifies the options of the search.
The SearchFlags enumeration that specifies whether the search goes by column, row coordinates or row, column coordinates.
The SearchFoundFlags enumeration that indicates whether the search includes the content in the cell notes, tag, or text.
The area of the sheet to search.
The starting index of the row at which to start.
The starting index of the column at which to start.
The ending index of the row at which to end.
The ending index of the column at which to end.
The row index at which a match is found.
The column index at which a match is found.
The found string.
Searches the text in the cells in the specified sheet for the specified string with the specified criteria and start and end location, and whether to search notes and tags as well.
Syntax
'Declaration
 
Public Overloads Function Search( _
   ByVal searchString As System.String, _
   ByVal searchFlags As SearchFlags, _
   ByVal searchOrder As SearchOrder, _
   ByVal searchTarget As SearchFoundFlags, _
   ByVal sheetArea As SheetArea, _
   ByVal rowStart As System.Integer, _
   ByVal columnStart As System.Integer, _
   ByVal rowEnd As System.Integer, _
   ByVal columnEnd As System.Integer, _
   ByRef foundRowIndex As System.Integer, _
   ByRef foundColumnIndex As System.Integer, _
   ByRef foundString As System.String _
) As SearchFoundFlags
'Usage
 
Dim instance As Worksheet
Dim searchString As System.String
Dim searchFlags As SearchFlags
Dim searchOrder As SearchOrder
Dim searchTarget As SearchFoundFlags
Dim sheetArea As SheetArea
Dim rowStart As System.Integer
Dim columnStart As System.Integer
Dim rowEnd As System.Integer
Dim columnEnd As System.Integer
Dim foundRowIndex As System.Integer
Dim foundColumnIndex As System.Integer
Dim foundString As System.String
Dim value As SearchFoundFlags
 
value = instance.Search(searchString, searchFlags, searchOrder, searchTarget, sheetArea, rowStart, columnStart, rowEnd, columnEnd, foundRowIndex, foundColumnIndex, foundString)
public SearchFoundFlags Search( 
   System.string searchString,
   SearchFlags searchFlags,
   SearchOrder searchOrder,
   SearchFoundFlags searchTarget,
   SheetArea sheetArea,
   System.int rowStart,
   System.int columnStart,
   System.int rowEnd,
   System.int columnEnd,
   out System.int foundRowIndex,
   out System.int foundColumnIndex,
   out System.string foundString
)

Parameters

searchString
The string for which to search.
searchFlags
The SearchFlags enumeration that specifies the options of the search.
searchOrder
The SearchFlags enumeration that specifies whether the search goes by column, row coordinates or row, column coordinates.
searchTarget
The SearchFoundFlags enumeration that indicates whether the search includes the content in the cell notes, tag, or text.
sheetArea
The area of the sheet to search.
rowStart
The starting index of the row at which to start.
columnStart
The starting index of the column at which to start.
rowEnd
The ending index of the row at which to end.
columnEnd
The ending index of the column at which to end.
foundRowIndex
The row index at which a match is found.
foundColumnIndex
The column index at which a match is found.
foundString
The found string.

Return Value

A SearchFoundFlags enumeration that specifies what is matched.
Example
This example uses the Search method.
private void Window_Loaded(object sender, RoutedEventArgs e)
        {
gcSpreadSheet1.Sheets[0].Cells[5, 4].Text = "test";
gcSpreadSheet1.Invalidate();                
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            int colfound;
            int rowfound;
            string foundstring;
            colfound = 0;
            rowfound = 0;            
            gcSpreadSheet1.Sheets[0].Search("test", out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, out rowfound, out colfound);
            //gcSpreadSheet1.Sheets[0].Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, out rowfound, out colfound, out foundstring);
            listBox1.Items.Add(colfound.ToString());            
            gcSpreadSheet1.Invalidate();
        }
Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
GcSpreadSheet1.Sheets(0).Cells(5, 4).Text = "test"
GcSpreadSheet1.Invalidate()
End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim colfound As Integer
Dim rowfound As Integer
Dim sheetfound As Integer
Dim foundstring As String
colfound = 0
rowfound = 0
sheetfound = 0
foundstring = ""
GcSpreadSheet1.SheetCount = 2
GcSpreadSheet1.Sheets(0).Search("test", rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, rowfound, colfound)
'GcSpreadSheet1.Sheets(0).Search("test", GrapeCity.Windows.SpreadSheet.Data.SearchFlags.ExactMatch, GrapeCity.Windows.SpreadSheet.Data.SearchOrder.ZOrder, GrapeCity.Windows.SpreadSheet.Data.SearchFoundFlags.CellText, GrapeCity.Windows.SpreadSheet.Data.SheetArea.Cells, 0, 0, 7, 7, rowfound, colfound, foundstring)
ListBox1.Items.Add(colfound.ToString())
GcSpreadSheet1.Invalidate()
    End Sub
See Also

Reference

Worksheet Class
Worksheet Members
Overload List