I am trying to figure out how to write a for each statement so that this will keep looping through finding all the users, since right now, it only finds he first user. Any help will be greatly appreciated. Thank you!
Dim item As New ListViewItem
item = New ListViewItem
Dim itm As New ListViewItem(objRecordSet.Fields("sAMAccountName").Value().ToString)
itm.SubItems.Add(objRecordSet.Fields("givenName").Value().ToString)
itm.SubItems.Add(objRecordSet.Fields("SN").Value().ToString)
ListView1.Items.Add(itm)
Here is code for the task you are asking (not tested)
If Not (objRecordSet.EOF And objRecordSet.BOF) Then
objRecordSet.MoveFirst
While Not objRecordSet.EOF
Dim itm As New ListViewItem(objRecordSet.Fields("sAMAccountName").Value().ToString)
itm.SubItems.Add(objRecordSet.Fields("givenName").Value().ToString)
itm.SubItems.Add(objRecordSet.Fields("SN").Value().ToString)
ListView1.Items.Add(itm)
objRecordSet.MoveNext
Wend
End If