Assuming that I have a listbox on the full window, but the retrieved data from database are just 2 rows.
In that case, I see 20 rows and 18 rows are blank.
I can’t expect how many rows will be retrieved in advance. Only know it will be less than 20.
I just want to see 2 rows and don’t want to see the 18 of blank rows.
That’s what I do, and is the standard behavior for some of the VB6 grids I cut my teeth on. In the CellBackgroundPaint event:
If row < Me.ListCount Then
' normal cell drawing here
Else ' below last active row, fill in with gray
g.ForeColor = &c888888
g.FillRect(0, 0, g.width, g.height)
End If