Re: Saving Listview Selected Item Problems



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


"Saucer Man" <saucerman@xxxxxxxxxx> wrote in message
news:aU%Ei.87302$jH3.286@xxxxxxxxxxxxxxxxxxxxxxxxx
Can you explain about these "unique record numbers" and how to use them?

--

Thanks.


"JP Bless" <jp3BlessNoSpam@xxxxxxxxxxx> wrote in message
news:eoOiZvz8HHA.748@xxxxxxxxxxxxxxxxxxxxxxx
Better to use unique record number instead of index of listview.


"Saucer Man" <saucerman@xxxxxxxxxx> wrote in message
news:l7ZEi.60134$Lu.40473@xxxxxxxxxxxxxxxxxxxxxxxxx
When I exit my app, I save the listview selected item index in a text
file. When I open the app, I retrieve this index and select the item
again in the listview. This is working sporatically. Sometimes when I
click on a different column in the listview to change the sorting, if I
close my app and re-open it, I have a different item in the listview
selected. Othertimes when I do this it works fine. I am also saving the
sort key and sort order. How can I make it so that no matter what
column is sorted, the same item in the listview is retrieved when the
app is opened?

--

Thanks.









.



Relevant Pages

  • Re: Saving Listview Selected Item Problems
    ... When I open the app, I retrieve this index and select the item ... click on a different column in the listview to change the sorting, ... sort key and sort order. ...
    (microsoft.public.vb.general.discussion)
  • Saving Listview Selected Item Problems
    ... When I exit my app, I save the listview selected item index in a text file. ... I retrieve this index and select the item again in the ... I am also saving the sort key and ...
    (microsoft.public.vb.general.discussion)
  • Re: Saving Listview Selected Item Problems
    ... When I open the app, I retrieve this index and select the item again in the ... different column in the listview to change the sorting, ... I am also saving the sort key and ...
    (microsoft.public.vb.general.discussion)
  • Re: Saving Listview Selected Item Problems
    ... Better to use unique record number instead of index of listview. ... I retrieve this index and select the item again ... app and re-open it, I have a different item in the listview selected. ... I am also saving the sort key ...
    (microsoft.public.vb.general.discussion)
  • Re: Sending WM_LBUTTONDBLCLK to a ListView control
    ... I wrote up a quick WinForm app with a button and a listview. ... HWND of the listview and using its PointToScreen/PointToClient functions. ... public const UInt32 WM_MOUSEACTIVATE = 0x0021; ...
    (microsoft.public.dotnet.framework.interop)