01-14-2004, 11:08 AM
I have a dbgrid and I need to be able to search the records in the grid and have the record it found highlighted and then be able to find the next record.
Can anyone help point me in the right direction.
01-14-2004, 11:18 AM
I might be not original with my answer, but if you can then switch to using FlexGrid control which is far more user friendly and flexible in my view
01-14-2004, 11:24 AM
well just in case how did you populate your grid?
01-15-2004, 09:11 PM
Im using a Data control to populate my grid.
01-16-2004, 01:25 AM
before using dbgrid you must bind dbgrid to a adodc.
and if you use adodc answer of your question is to easy.
adodc1.Recordset.Find "ISIRALAMA=" & str(siralama_id_asagidaki)
(ISIRALAMA is a field)
the cursor of adodc1 goes to the record you want to find. and then dbgrid is highlight the this record (because dbgrid was connected to adodc1).
01-16-2004, 04:59 AM
try this code
'this is the code for searching of string
adodc1.recordset.find "Field1 ='" & whattofind & "'"
if not Adodc1.Recordset.eof then
'this is the code for selection
ps: if you want to un-select the selected row
you can use the datagrid1.selbookmarks.remove but you need to loop through the selbookmarks
note : not tested