Good day!

I have a listview loaded in a form in a lvwIcon view with checkboxes enabled.. I have checked some items from it, let say 5 items. Now when I switch the view to lvwReport, the checked items are gone. How to make it selected again?

Thank you for helping!

Recommended Answers

All 2 Replies

Store the checked items in an array. After changing the viewtype varify and check them programmatically.
The codes should be like

Dim x as Integer = 0
For litm As ListViewItem in ListView1.Items
    For i As Integer = x to UBound(LitmArray)
        If litm.Text = LitmArray(i) Then
            litm.Checked = True
            x += 1
        End If
    Next

    If x>= UBound(LitmArray) Then
        Exit For
    End If
Next

thanks Shark 1 for the idea..array works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.