ListView Clearing and Non-Mouse Click Highlighting

Working with the ListView control i have found that if you were to say highlight a selection in a listview control with your mouse, store this index value, clear the listview completely, then put back the information taht was cleared and manually highlight the previously highlighted selection it wont highlight.  
By going through debug i find that it does highlight just after the line that tells it to rehighlight the selection back but once it end's that subroutine the highlighted selection turns off.  
What is causing this and how do i remedy it?
To give you more info i set the listview's property: HideSelection to "FALSE" meaning to maintain its highlighted selection if i somehow loose focus on the listview.
here are my other property selections:

   Begin ComctlLib.ListView ListView1
      Height          =   4335
      Left            =   6480
      TabIndex        =   68
      Top             =   375
      Width           =   2775
      _ExtentX        =   4895
      _ExtentY        =   7646
      View            =   3
      LabelEdit       =   1
      MultiSelect     =   -1  'True
      LabelWrap       =   0   'False
      HideSelection   =   0   'False
      _Version        =   327680
      SmallIcons      =   "ImageList1"
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Appearance      =   1
      NumItems        =   2
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Name"
         Object.Width           =   2117
      BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
         SubItemIndex    =   1
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Type"
         Object.Width           =   1676

Weird huh?  Please help.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you show the source that you use to do this task?
Option Explicit
Dim lngHold As Long

Private Sub Command1_Click()
    Dim intI As Integer
    For intI = 1 To 10
        Call ListView1.ListItems.Add(intI, , intI)
    Next intI
End Sub

Private Sub Command2_Click()

End Sub

Private Sub Command3_Click()
    Dim intI As Integer
    For intI = 1 To 10
        Call ListView1.ListItems.Add(intI, , intI)
    Next intI
    Set ListView1.SelectedItem = ListView1.ListItems(lngHold)
End Sub

Private Sub ListView1_Click()
    lngHold = ListView1.SelectedItem.Index
End Sub

This code does what you are sayiing, with proper highlighting!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
flufgirlAuthor Commented:
Thanks Anthony but your code works...
And mine still doesnt...go figure....
Your methods are EXACTLY what i implemented into mine originally and i tested your code as a new project and it worked fine.
I also took this portion of the code out of my bigger program and tested it out in a new project and it too works fine, but the weird thing is that it isnt working with the whole program.

I went step by step through the debugger and found that it DOES highlight fine but as soon as it gets to the "End Sub" line it shuts off the highlight.

Are there any programs out there that can trace through your code to see what vb is actually calling (ie. events that i havent put in,etc) or something that i can do to track down what is turning off the highlight?  

PLEASE....i have been looking for 2 months now trying to figure out this error.

Ok, here is what i am trying to do....
I am trying to make it so that if the user double clicks an item in thelistview it will clear the listview and display a new items inside the listview window but following these new items will be the actual selected item.  So instead of storing the index value for the selected item i actually store a "key".
So, when the new items are displayed on screen i check up the key value of what was selected and look through this new list and once i find a match i highlight that item.  Makes sense...but the odd thing is that once i do this it does highlight the item but as soon as it goes past the "End Sub" line (finishing the subroutine) the highlight disappears....
Is this a BUG in VB 5? or am i doing something wrong?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.