I have a function (see below) which returns a select box of the files in a certain folder the problem is it isn't alphabetizes. Any suggestions? If I need to sort it myself if someone has a good sorting algorithm they could post I would appreciate it.
Code:
Function opt_getPopUpsFolder(fileLink)
Dim strPathInfo, strPhysicalPath, opt
strPathInfo = "../../PopUps/index.asp"
strPhysicalPath = Server.MapPath(strPathInfo)
Dim objFSO, objFile, objFileItem, objFolder, objFolderContents, objsubfol
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
Set objsubfol = objFolder.SubFolders
For Each objFileItem in objFolderContents
IF objFileItem.Name <> "Thumbs.db" and objFileItem.Name <> "index.asp" THEN
IF instr(1,objFileItem.Name,"_") <> 1 THEN
opt = opt & "<Option "
if objFileItem.Name = fileLink then opt = opt & " selected "
opt = opt & ">" & objFileItem.Name & "</option>"
end if
end if
Next
Set objFSO = Nothing
Set objFile = Nothing
Set objFolder = Nothing
Set objFolderContents = Nothing
Set objsubfol = Nothing
opt_getPopUpsFolder = opt
End Function
thanks,
Sam
~~~~~~~~~~~~~~~~~~~~~~~
http://byldesigns.com
~~~~~~~~~~~~~~~~~~~~~~~