Advertisement
2_2002-2004 Miscellaneous #116575

A-1 ListBox (style =1) select

For Beginners. Copy the contents of ListBox1 to ListBox2 where the contents of ListBox1 is checked off. Remove any duplicates from ListBox2 and remove contents of ListBox2 where the contents of ListBox1 becomes unselected. (uhmmm... hope that made sense)

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub List1_Click()
Dim X As Long
Dim y As Long
Dim j As Long
j = 0
' Add selected items to ListBox2
 For X = 0 To List1.ListCount - 1
 If List1.Selected(X) = True Then
  List2.AddItem List1.List(X)
 End If
 Next
 
 ' Get rid of the now unselected items
 
 Dim i As Long
 For y = 0 To List1.ListCount - 1
 For i = 0 To List1.ListCount - 1
 List2.Text = List2.List(i)
 If List2.List(i) = List1.List(y) And List1.Selected(y) = False Then
  List2.RemoveItem i
 End If
 Next i
 Next
'Get rid of any duplicates in ListBox2
 
Do While j < List2.ListCount
 
 List2.Text = List2.List(j)
 
 If List2.ListIndex <> j Then
  List2.RemoveItem j
 Else
  j = j + 1
 End If
Loop
 
End Sub
Original Comments (3)
Recovered from Wayback Machine