I have a listbox in a winform. It is set for multiple selections. However, I need to be able to un-select all of the items in the list. Here is what I am doing:
For j = 0 To UBound(arClass)
For i = 0 To Me.lstMgrClassifications.Items.Count - 1
If arClass(j) = (CType(CType(CType(Me.lstMgrClassifications.Items(i), Object), System.Data.DataRowView).Row, System.Data.DataRow).ItemArray(0)) Then
Me.lstMgrClassifications.SetSelected(i, True)
Exit For
Else
Me.lstMgrClassifications.SetSelected(i, False)
End If
Next
Next
This works well except for the very first item in the list. It is always selected.
How can I un-select it?
Thanks,
enak
For j = 0 To UBound(arClass)
For i = 0 To Me.lstMgrClassifications.Items.Count - 1
If arClass(j) = (CType(CType(CType(Me.lstMgrClassifications.Items(i), Object), System.Data.DataRowView).Row, System.Data.DataRow).ItemArray(0)) Then
Me.lstMgrClassifications.SetSelected(i, True)
Exit For
Else
Me.lstMgrClassifications.SetSelected(i, False)
End If
Next
Next
This works well except for the very first item in the list. It is always selected.
How can I un-select it?
Thanks,
enak