By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,151 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,151 IT Pros & Developers. It's quick & easy.

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

P: n/a
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_APPEND, "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

Aug 18 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Mark B" <ma********@hotmail.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_APPEND, "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/>

Aug 18 '08 #2

P: n/a
Sorry, you've got to have a reference to Active DS Type library.

....

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

objOU.PutEX ADS_PROPERTY_APPEND, "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_APPEND = 3.

"InstallKeys" 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]" <hi***************@gmx.atwrote in message
news:e0**************@TK2MSFTNGP02.phx.gbl...
"Mark B" <ma********@hotmail.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_APPEND, "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/>
Aug 18 '08 #3

P: n/a
Hi Mark,

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

objOU.PutEX ADS_PROPERTY_APPEND, "wbempath", Product & "|" & Key

Or:

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

Or:

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



"Mark B" <ma********@hotmail.comwrote in message
news:e0**************@TK2MSFTNGP04.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_APPEND, "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_APPEND = 3.

"InstallKeys" 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]" <hi***************@gmx.atwrote in message
news:e0**************@TK2MSFTNGP02.phx.gbl...
>"Mark B" <ma********@hotmail.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_APPEND, "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/>
Aug 19 '08 #4

P: n/a
You guys (and Bill, especially) are just freakin legends!

Thanks Group!

(This one did it...)

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

Aug 19 '08 #5

P: n/a
Thanks Mark,

Glad it helped :)

"Mark B" <ma********@hotmail.comwrote in message
news:ez**************@TK2MSFTNGP05.phx.gbl...
You guys (and Bill, especially) are just freakin legends!

Thanks Group!

(This one did it...)

objOU.PutEX ADS_PROPERTY_APPEND, "wbempath", New Object() { Product & "|"
& Key}
Aug 19 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.