473,511 Members | 15,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create an array

maxamis4
295 Recognized Expert Contributor
Hello,

My LDAP query is working. However I want to store the values in an array. Very simply put the examples online for arrays suck. Is there a very easy step by step method of creating a string array. Below is my code and what I tried to do:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btn_Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Search.Click
  2.  
  3.         Dim UserID As String
  4.         Dim RootDSE As New DirectoryServices.DirectoryEntry("LDAP://RootDSE")
  5.         Dim DomainDN As String = RootDSE.Properties("DefaultNamingContext").Value
  6.         Dim ADEntry As New DirectoryServices.DirectoryEntry("LDAP://" & DomainDN)
  7.  
  8.  
  9.         Dim objSearch As New System.DirectoryServices.DirectorySearcher(ADEntry)
  10.         'Dim ADSearchResult As System.DirectoryServices.SearchResult
  11.         Dim oResults As DirectoryServices.SearchResultCollection
  12.         Dim oResult As DirectoryServices.SearchResult
  13.         Dim RetArray() As String
  14.         'Dim myresults As String
  15.         Dim i As Integer
  16.  
  17.         i = 0
  18.  
  19.         UserID = txt_Name.Text
  20.         objSearch.PropertiesToLoad.Add("uid")
  21.         objSearch.PropertiesToLoad.Add("givenname")
  22.         objSearch.PropertiesToLoad.Add("cn")
  23.         objSearch.Filter = ("(samAccountName=*" & UserID & "*)")
  24.         oResults = objSearch.FindAll
  25.  
  26.         For Each oResult In oResults
  27.  
  28.             RetArray(i) = oResult.GetDirectoryEntry.Properties("cn").Value
  29.             RetArray.Sort(RetArray)
  30.  
  31.             lb_Names.Items.Add(RetArray)
  32.  
  33.  
  34.             i = i + 1
  35.         Next
  36.  
  37.     End Sub
  38.  
  39.  

any help is appreicated
Apr 15 '08 #1
0 755

Sign in to post your reply or Sign up for a free account.

Similar topics

7
8823
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
23
7366
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
1
1329
geo039
by: geo039 | last post by:
Okay I have an application, which is to demonstrate the use of a created class. I have a previous and next button which cycles through the array. However I need the user to be able to create a new...
10
3941
by: SM | last post by:
Hello I'm trying to create a multi dimensional array in JavaScript, but after some reading i still can't figure out how to apply it to my model. Here it is: I have a list A and for each item...
3
4831
by: David K in San Jose | last post by:
I'm using managed (CLR) C++ in VS2005 to create a Windows app that contains a form named "MyForm". In the code for that form I'm trying to invoke some static functions by using an array of function...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.