vb6 ListView1 = ListView2
Posted on 2010-11-12
I have this form in VB6 in which I have several ListViews. Turns out that I have a For/Next loop to run in each one of those listviews, however I did not want to have to rewrite the loop for each one of the listview. So, I am now trying to find a way to create a method/function in which I pass the ListView control to, run the loop in the items in that list, performing the changes as necessary such as checking on/off the check box, and then returning the revewed listview back from that function.
Private Function ChangeListView(lvwX as ListView) as ListView
For i = 1 To lvwX.ListItems.Count
if lvwX.ListItems(i).Text = "abc" then
lvwX.ListItems(i).Checked = True
Then I would do....
ListView1 = ChangeListView(ListView1)
Everything goes well until I return from my function with my changed listview. I won't let me make the ListView1 = My new Listview
Thx a bunch..