Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change full row select back colour or list view
#2
Hm, well, looking at your existing code.. I don't really know what you're doing. Sorry about that.

So, I wrote my own method which should do what you intended. I don't know if it's what you wanted, but you can take a look at it.

Code:
'This method colors all of the list view items according to the following data
    'Selected items: backcolor = light green
    'Unselected items: backcolor = white
    '@param: the listview to be searched and colored
    Public Sub RecolorListView(ByVal lstView As ListView)
        'Scroll through each listview item
        For Each item In lstView.Items

            If lstView.SelectedItems.Contains(item) Then 'The item is selected
                CType(item, ListViewItem).BackColor = Color.LightGreen 'Color it green!
            Else 'The item is not selected
                CType(item, ListViewItem).BackColor = Color.White 'Color it white
            End If

        Next
    End Sub

Pastebin version: <!-- m --><a class="postlink" href="http://pastebin.com/jhmyty3t">http://pastebin.com/jhmyty3t</a><!-- m -->

Just call this method every time the SelectedIndex is changed on the ListView control.
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Re: Change full row select back colour or list view - by brandonio21_phpbb3_import2 - 05-21-2012, 03:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  View 3D Models in VB .NET Worf 2 13,710 10-14-2014, 04:47 AM
Last Post: Worf
  NullReferenceException when adding item to generic list brco900033 1 9,912 06-17-2014, 12:16 AM
Last Post: brandonio21
  Full screen game overlay? Ecnarf 1 8,610 01-29-2013, 09:14 AM
Last Post: xolara

Forum Jump:


Users browsing this thread: 1 Guest(s)