Discussion Locked

VB6 -DBGrid

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Who knows of a better way to program a DBGrid to use basic funtions (like every other grid) such as Ctrl-A to mark all records, or use the SHIFT key and mouse to mark records between the current records and the mouse position.
The Ctrl-mouse click to mark several individual records is already built.

And I have been able to program the Ctrl-A with 15 lines - no problem.

But using the SHIFT and mouse, I can only mark records for the VISIBLE rows (row 0 to the VisibleRows property - but marking rows before row 0 or after the VisibleRows, and then doing something such as a deletion, doesn't work and sometimes causes a crash.

Also, the ability of copying and pasting a record seems to not work.

7 replies

by sl-campbell

Assumming you are using a collection for the other functions.
So, do the same for this one.
If the mouse is clicked while the shift is pressed, then get the bookmark each time and add it to the collection. If the collection count is >2 then reset it.
When the user copies (Ctrl-C), then loop through the Recordset!, from the beginnng, comparing the bookmark of the current record with the 2 saved ones. It doesn't matter which comes first, because you only want to copy the bookmarks BETWEEN the two records, inclusive.

This discussion is closed to new replies.