The list is empty until items are moved over via cmd buttons:
Code:
Private Sub cmdMoveAllToList1_Click()
MoveAllItems "lstSelectedStudents", "lstAllStudents"
End Sub
Private Sub cmdMoveToList1_Click()
MoveSingleItem "lstSelectedStudents", "lstAllStudents"
End Sub
Private Sub cmdMoveToList2_Click()
MoveSingleItem "lstAllStudents", "lstSelectedStudents"
End Sub
Private Sub cmdMoveAllToList2_Click()
MoveAllItems "lstAllStudents", "lstSelectedStudents"
End Sub
Sub MoveSingleItem(strSourceControl As String, strTargetControl As String)
Dim strItem As String
Dim intColumnCount As Integer
For intColumnCount = 0 To Me.Controls(strSourceControl).ColumnCount - 1
strItem = strItem & Me.Controls(strSourceControl).Column(intColumnCount) & ";"
Next
strItem = Left(strItem, Len(strItem) - 1)
'Check the length to make sure something is selected
If Len(strItem) > 0 Then
Me.Controls(strTargetControl).AddItem strItem
Me.Controls(strSourceControl).RemoveItem Me.Controls(strSourceControl).ListIndex
Else
MsgBox "Please select an item to move."
End If
End Sub
Sub MoveAllItems(strSourceControl As String, strTargetControl As String)
Dim strItem As String
Dim intColumnCount As Integer
Dim lngRowCount As Long
For lngRowCount = 0 To Me.Controls(strSourceControl).ListCount - 1
For intColumnCount = 0 To Me.Controls(strSourceControl).ColumnCount - 1
strItem = strItem & Me.Controls(strSourceControl).Column(intColumnCount, lngRowCount) & ";"
Next
strItem = Left(strItem, Len(strItem) - 1)
Me.Controls(strTargetControl).AddItem strItem
strItem = ""
Next
Me.Controls(strSourceControl).RowSource = ""
End Sub
That is all the code that is associated with the two listboxes before adding the data to tables.
The problem is that it is highlighting everything from what is selected up to the first entry in the listbox, but only moving the item that was clicked.
I would like it to be where i can use the extended property to use CTRL to select multiple students to move to the other listbox.