Help with For Each loop in VB.NET

Author Message
stubar

  • Total Posts : 69
  • Scores: 0
  • Reward points : 0
  • Joined: 7/14/2005
  • Status: offline
Help with For Each loop in VB.NET Tuesday, November 11, 2008 9:40 PM (permalink)
0
Hi
Hopefully someone can help me with this little problem:
I have the script below working:
But I want to carry the value S out of the For Next loop.
The script loops through the proxyaddresses field in AD and I need to capture them all in order to add a new one plus the old ones.
Any help would be appreciated.
Thanks in advance.
 
Stuart





Dim results As SearchResultCollection
results = searcher.FindAll()
Dim result As SearchResult
 


For Each result In results
Dim proxyAddresses As ArrayList = New ArrayList
For Each s As String In result.Properties.Item("proxyAddresses")
proxyAddresses.Add(s)
Dim addys As String

addys = s
MsgBox(addys)
Next

Next
Can't type, can't spell, can barely read. Can't you tell?
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Help with For Each loop in VB.NET Wednesday, November 12, 2008 3:57 AM (permalink)
    0
    If I understand the question, then Dim ProxyAddresses outside the loop. Then when the loop is finished it would hold a list of the addresses.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      stubar

      • Total Posts : 69
      • Scores: 0
      • Reward points : 0
      • Joined: 7/14/2005
      • Status: offline
      RE: Help with For Each loop in VB.NET Wednesday, November 12, 2008 4:21 AM (permalink)
      0
      Thank you
      Forest and trees.
       
      You don't have any tips on appending to a multi value attribute in AD do you?
      I would use something like: objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", Array("smtp:" & newmail2)
      in vb script but can't make the leap to VB.NET
       
      I can easily add a new smtp address but the trick is not wiping out those that are already there.
      I know I can use entry.Invoke("putex", new object() but I don't know how to implement it.
       
      Any help would be much appreciated.
      Thanks in advance
      Can't type, can't spell, can barely read. Can't you tell?
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9