Array(Value & "|" & Value2) from VB6 to VB.Net 2008

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark B

    Array(Value & "|" & Value2) from VB6 to VB.Net 2008

    Hi experts,

    I'm converting a homebrew AD management progam I wrote, from VB6 to VB 2008.

    I've got some code that sticks values in to Active Directory like this:-

    objOU.PutEx ADS_PROPERTY_AP PEND, "wbempath, Array(Product & "|" and Key)

    Basically, a convenient place for me to store and manage CD installation
    keys.

    In VB6, the 'Array' bit works fine.

    VB 2008 spits it out. "'Array' is a type and cannot be used as an
    expression."

    What is the equivalent syntax in VB 2008?

    Thanks,

    Mark B

  • Herfried K. Wagner [MVP]

    #2
    Re: Array(Value & "|&quot ; & Value2) from VB6 to VB.Net 2008

    "Mark B" <marximus27@hot mail.comschrieb :
    I'm converting a homebrew AD management progam I wrote, from VB6 to VB
    2008.
    >
    I've got some code that sticks values in to Active Directory like this:-
    >
    objOU.PutEx ADS_PROPERTY_AP PEND, "wbempath, Array(Product & "|" and Key)
    There's something wrong with the code above, it won't even compile in VB6.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Mark B

      #3
      Re: Array(Value &amp; &quot;|&quot ; &amp; Value2) from VB6 to VB.Net 2008

      Sorry, you've got to have a reference to Active DS Type library.

      ....

      Set objou = GetObject("LDAP ://CN=InstallKeys, " & MyDomain)

      objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", Array(Product & "|" & Key)

      ObjOu.SetInfo

      Set objOU = Nothing

      ....

      The "MyDomain" bit is the FQDN of my domain. (DC=MySite, DC=GOV, DC=AU),
      etc.

      ADS_PROPERTY_AP PEND = 3.

      "InstallKey s" is a container node in the root of my Active Directory (a
      contact).

      Product = "Windows XP SP2 Integrated" or some other string that the key is
      for.

      The pipe -"|" is used to delimit the product and the key, when reading back
      the info later.

      The key is the installation key or code.

      Notice also I had a missing " at the end of "wbempath".

      Apologies.

      Mark





      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
      news:e06FfPUAJH A.4312@TK2MSFTN GP02.phx.gbl...
      "Mark B" <marximus27@hot mail.comschrieb :
      >I'm converting a homebrew AD management progam I wrote, from VB6 to VB
      >2008.
      >>
      >I've got some code that sticks values in to Active Directory like this:-
      >>
      >objOU.PutEx ADS_PROPERTY_AP PEND, "wbempath, Array(Product & "|" and Key)
      >
      There's something wrong with the code above, it won't even compile in VB6.
      >
      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      • Bill McCarthy

        #4
        Re: Array(Value &amp; &quot;|&quot ; &amp; Value2) from VB6 to VB.Net 2008

        Hi Mark,

        Array(Product & "|" & Key) is a single element array with a single string
        value. I'd try :

        objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", Product & "|" & Key

        Or:

        objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", New String() { Product & "|" &
        Key}

        Or:

        objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", New Object() { Product & "|" &
        Key}







        "Mark B" <marximus27@hot mail.comwrote in message
        news:e0$VdLYAJH A.5316@TK2MSFTN GP04.phx.gbl...
        Sorry, you've got to have a reference to Active DS Type library.
        >
        ...
        >
        Set objou = GetObject("LDAP ://CN=InstallKeys, " & MyDomain)
        >
        objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", Array(Product & "|" & Key)
        >
        ObjOu.SetInfo
        >
        Set objOU = Nothing
        >
        ...
        >
        The "MyDomain" bit is the FQDN of my domain. (DC=MySite, DC=GOV, DC=AU),
        etc.
        >
        ADS_PROPERTY_AP PEND = 3.
        >
        "InstallKey s" is a container node in the root of my Active Directory (a
        contact).
        >
        Product = "Windows XP SP2 Integrated" or some other string that the key is
        for.
        >
        The pipe -"|" is used to delimit the product and the key, when reading
        back the info later.
        >
        The key is the installation key or code.
        >
        Notice also I had a missing " at the end of "wbempath".
        >
        Apologies.
        >
        Mark
        >
        >
        >
        >
        >
        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
        news:e06FfPUAJH A.4312@TK2MSFTN GP02.phx.gbl...
        >"Mark B" <marximus27@hot mail.comschrieb :
        >>I'm converting a homebrew AD management progam I wrote, from VB6 to VB
        >>2008.
        >>>
        >>I've got some code that sticks values in to Active Directory like this:-
        >>>
        >>objOU.PutEx ADS_PROPERTY_AP PEND, "wbempath, Array(Product & "|" and Key)
        >>
        >There's something wrong with the code above, it won't even compile in
        >VB6.
        >>
        >--
        >M S Herfried K. Wagner
        >M V P <URL:http://dotnet.mvps.org/>
        >V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
        >

        Comment

        • Mark B

          #5
          Re: Array(Value &amp; &quot;|&quot ; &amp; Value2) from VB6 to VB.Net 2008

          You guys (and Bill, especially) are just freakin legends!

          Thanks Group!

          (This one did it...)

          objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", New Object() { Product & "|" &
          Key}

          Comment

          • Bill McCarthy

            #6
            Re: Array(Value &amp; &quot;|&quot ; &amp; Value2) from VB6 to VB.Net 2008

            Thanks Mark,

            Glad it helped :)

            "Mark B" <marximus27@hot mail.comwrote in message
            news:ezjjDDcAJH A.1940@TK2MSFTN GP05.phx.gbl...
            You guys (and Bill, especially) are just freakin legends!
            >
            Thanks Group!
            >
            (This one did it...)
            >
            objOU.PutEX ADS_PROPERTY_AP PEND, "wbempath", New Object() { Product & "|"
            & Key}
            >

            Comment

            Working...