Windows 7 - Position listview vertical scrollbar where I want it in VB6

Asked By Laphan on 30-Nov-08 04:05 PM
Hi All

I know there are certain ways of doing this such as the enablevisible (or
whatever it is), but this option does kind of move the list round a bit and
I get more confused where I am than when the list used to simply go back to
the top.

I think there is a way round it as I have certain constraints over a
completely dynamic list, but I need assistance on how I can get that darned
scrollbar under control.

Details are as follows:

1) I have a listview that shows 13 rows at any one time.

2) My list can contain from 1 to 40 rows (no more, no less)

3) How the listview currently works is that a user clicks on a row and then
the info relating to that row appears in a number of textboxes (classic
approach :0).  When the user updates the info, I then 'refresh' the listview
to make sure I display the latest info.  When I say refresh I mean I delete
the listview contents and then re-input the latest data.

4) At present, if the user updates rows 1 - 13 I make the index = 1 as there
is no reason for the user to see or scroll down any further.

If the user updates the last 13 rows (I have a feeling I'm going to get
issues if I only have say 20 rows altogether then I make the index = the
total count of the rows, ie the last row so that they still see the last
update plus the records around it.

My problem is the 'x' amount between the first 13 and last 13.

I basically want the listview to remain exactly where the user last left it,
but it seems impossible.

Any help you can give would be very much appreciated.

Rgds




Michael Cole replied on 30-Nov-08 05:57 PM
EnsureVisible?


[SNIP]


Don't delete the contents - just update the existing items.  That's the only
way to ensure that the location does not change.


--
Regards

Michael Cole