哦,看了看文档明白了。。。
if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array.
'initiate
path = server.mappath(path)
set fso=server.CreateObject("scripting.filesystemobject")
set objFolder=fso.GetFolder(path)
set objfiles = objfolder.files
'把文件名及文件路经存入theFiles数组
int slot = 0
Dim theFiles()
redim theFiles(50,50)
for each objFile in objFiles
filename = objFile.name
filePath = split(objFile.path,"docs\")
thepath1 = "。/docs/"
thepath = thepath1 & filepath(1)
theFiles(slot,0) = filename
theFiles(slot,1) = thepath
slot = slot + 1
if slot > UBound(theFiles) then
ReDim Preserve theFiles(Slot+20,slot+20)
end if
next
ReDim Preserve theFiles(slot,slot) '******就是这里出问题!!!!!!
'冒泡排序
for i = 0 to UBound(theFiles)-1
for j = i+1 to UBound(theFiles)
if strComp(theFiles(i,0),theFiles(j,0)) = 1 then
tmpFilename = theFiles(i,0)
tmpFilePath = theFiles(i,1)
theFiles(i,0) = theFiles(j,0)
theFiles(i,1) = theFiles(j,1)
theFiles(j,0) = tmpFilename
theFiles(j,1) = tmpFilePath
end if
next
next
'输出
for i = 0 to UBound(theFiles)
%>
<p align = "left">
---<img src='../../images/arrow_orange.gif' width='14' height='11'>
<a href='<%=theFiles(i,1)%>'><span class="activelink_yellow"><%=theFiles(i,0)%></span></a>
</p>
<%
next
end function
%>