Jump to content
bazzer747

DBGrid Row Selection Issue

Recommended Posts

Hi

I have two forms, each with a dbgrid showing items from different tables. On one grid when I select a row itrow highlights and the rows showing in the grid remain unchanged, as does the location of the row I selected. Using the up/down arrows moves the selected row up/down.

 

On the other grid when I select a row it immediately re-positions that selected row to the middle of the visible rows. Using the up/down arrows the row selected remains exactly in the vertical centre.

 

In the properties I can't see any differences between the two dbgrids, but would really like both dbgrids to behave the same way, whichever one of the above I don't mind.

 

Any thoughts would help.

Share this post


Link to post

Found the answer!

When I click on a cell in the grid I do a LocateEx on the fields value, this changes the record pointer which is causing the selected row to reposition itself in the centre. Not sure why this is, though. However, I replaced the LocateEx with a Lookup (which doesn't alter the record pointer) and all works as it should do now.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×