To read the contents of the cells, you can use the .TextMatrix property of the grid, eg:
Code:
strValue = MSFlexGrid1.TextMatrix(2,3)
To sort it, you can use the .Sort method (see the help for details and examples).
However.. it is generally better to let the database do the work instead (particularly for a search), by running an apt SQL statement to get the data you want.
To load the data sorted, simply add an Order By clause to the end of your SQL statement. If you want to allow sorting after it has been loaded (but keeping the same data), it is more efficient to use the grids .Sort method.