这就是您的代码中发生的事情
'Create an empty string array called PackUrls
Dim PackUrls As String()
'Create a new string array from the Split function
'and assign it to the variable PackUrls, replacing the old value.
PackUrls = Split(WebRequest("http://" + sPackBaseURI, _
sPackBaseURIUsername, sPackBaseURIPassword), ":")
没有从Split
to的结果复制PackUrls
。原始内容(顺便说一句)被替换为来自Split
. 因此无需调整数组的大小。您可以像这样轻松地重写您的代码,它会起作用:
Dim PackUrls As String() = Split(WebRequest("http://" + sPackBaseURI, _
sPackBaseURIUsername, sPackBaseURIPassword), ":")