Re: Saving Listview Selected Item Problems

Tech-Archive recommends: Fix windows errors by optimizing your registry




"JP Bless" <jp3BlessNoSpam@xxxxxxxxxxx> wrote in message
news:Oum9AS08HHA.5404@xxxxxxxxxxxxxxxxxxxxxxx
Some sort of "hack" solution. If you are reading data from some table and
the records have unique (record) number... if the user does not need to
see the unique record then create an extra listview column with 0 column
width. When your app close you save the unique number of the last selected
item. When your app open you use code like the one below to select the
last Item

For Each itmx in YourListView
If YourUniqueNumber = HiddenColumnData then
'Set as selected Item... put selected Item code here
Exit for
End if
Next

It's a LOT easier to "encode" that unique code into the listitem key than
mucking about with hidden columns and all the subclassing that is needed to
be certain that the column remains hidden.
Then all he needs to select is:
ListView1.ListItem(KEY).Selected = True
Where KEY is the key - duh!

Regards
Dave O.


.