I want my datagrid be able to scroll freely so that any row in it can be the first row. I mean, for example, if the datagrid is 5 rows tall and have 5 records in it, then it cannot scroll at all - because the last (5th) record is forced to stick to the bottom of the grid. And if there are 8 records, then it can scroll in a limited range - it can scroll until 4th row reaches top of grid and then cannot go further.
I have 2 plans to solve this problem:
(A) Let datagrid to hide certain rows. If there are 8 records and I want 7th row to be the first row, just hide the first 6 rows.
(B) Add blank rows right below the last record. The formula is
# of blank rows to be add = height of datagrid (in rows) - 1
This trick works this way: if there are 5 records and datagrid is 5 rows tall, then add 5 - 1 = 4 blank rows. Now there are more records than the grid height so it can scroll, when the last record (5th row) reachs the top, the 4 blank rows take up the space below so the last record (fake) still touchs bottom of the grid, now the grid is stuck again as it reaches the bottom, but it doesn't matter since the last REAL record already reaches the top.
Question:
Plan A: Is there such a "hide" method for datagrid? (I don't find it in object browser)
Plan B: I can add blank columns to datagrid by "SomeDatagrid.Columns.Add 3" but a statement like
"SomeDatagrid.Rows.Add 3" is illegal. I read an old thread said you can add rows by working on the recordset itself (ADO .Addnew) and then Refresh but I don't want to affect the recordset, I just want blank rows added to datagrid itself and vanish when the form unloads.
I have 2 plans to solve this problem:
(A) Let datagrid to hide certain rows. If there are 8 records and I want 7th row to be the first row, just hide the first 6 rows.
(B) Add blank rows right below the last record. The formula is
# of blank rows to be add = height of datagrid (in rows) - 1
This trick works this way: if there are 5 records and datagrid is 5 rows tall, then add 5 - 1 = 4 blank rows. Now there are more records than the grid height so it can scroll, when the last record (5th row) reachs the top, the 4 blank rows take up the space below so the last record (fake) still touchs bottom of the grid, now the grid is stuck again as it reaches the bottom, but it doesn't matter since the last REAL record already reaches the top.
Question:
Plan A: Is there such a "hide" method for datagrid? (I don't find it in object browser)
Plan B: I can add blank columns to datagrid by "SomeDatagrid.Columns.Add 3" but a statement like
"SomeDatagrid.Rows.Add 3" is illegal. I read an old thread said you can add rows by working on the recordset itself (ADO .Addnew) and then Refresh but I don't want to affect the recordset, I just want blank rows added to datagrid itself and vanish when the form unloads.