/build/static/layout/Breadcrumb_cap_w.png

Number 2 in a very occasional series

Something which I discovered quite by accident is that you can access lots of .Net functionality from VBScript.

For example, anyone who's progressed beyond the "Hello World" type script will know what a pain it is dealing with arrays. Leaving aside the response "So use dictionaries instead", how about using .Net's ArrayList methods? To wit:Option Explicit

Dim objDataList
Dim strItem

Set objDataList = CreateObject("System.Collections.ArrayList")

With objDataList
.Add "B"
.Add "C"
.Add "E"
.Add "D"
.Add "A"

.Sort()
End With

For Each strItem in objDataList
Wscript.Echo strItem
Next

WScript.Echo vbCRLF & "Now, remove element 'D' and we get:"

objDataList.Remove("D")

For Each strItem in objDataList
Wscript.Echo strItem
Next

0 Comments   [ + ] Show comments

Answers (0)

Be the first to answer this question

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ