Sort and Search with VB 6.0 and access 2003
Is there any commands in VB 6.0 that can automatically manipulate fields in MSHFlex Grid?
so that i can sort or search its cotents? Or, if there aren't any, what is the commands to manually manipulate the contents of the database?
by the way the flexgrid is connected to ms access via adodc.
Re: Sort and Search with VB 6.0 and access 2003
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.