Trying to sort in alphabetical order, the date I get from the txt file I have to use I tryed this. I get the same results as before(not in alphabetical order, but in the order that it is found in the file. Here's the code:
function DisplayLinks()
Dim objFS 'File System Object
Dim objFile 'File Object
Dim Name
Dim Link
Dim Desc
Dim Contact
Dim strTxtFile
Dim strLine
Dim nameArray(7)
Dim y
y = 0
IF language_type = "FR" then
strTxtFile = "textfileInFrench.txt"
else
strTxtFile = "textfileInEnglish.txt"
end if
Set objFS = CreateObject("Scripting.FileSystemObject"
If not objFS.FileExists(Server.MapPath(strTxtFile)) then
response.write "File Not Found"
Else
Set objFile = objFS.OpenTextFile(Server.MapPath(strTxtFile), 1, false)
Do Until (objFile.AtEndOfStream)
strLine = objFile.readline
GetValue(strLine)
name = GetValue(strLine)
nameArray
= name
y = y + 1
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
Loop
objFile.close
Dim bob, i, z
Dim totalElements
i = 0
z = 0
totalElements = 7
for i = 0 to (totalElements - 1)
for z = 1 to totalElements
If nameArray(i) > nameArray(z) then
bob = nameArray(i)
nameArray(i) = nameArray(z)
nameArray(z) = bob
z = z + 1
end if
next
i = i + 1
next
for i = 0 to totalElements
response.write "<ul><li><a href =""#" & nameArray(i) & """>" & nameArray(i) & "</a></ul>"
next
End if
function DisplayLinks()
Dim objFS 'File System Object
Dim objFile 'File Object
Dim Name
Dim Link
Dim Desc
Dim Contact
Dim strTxtFile
Dim strLine
Dim nameArray(7)
Dim y
y = 0
IF language_type = "FR" then
strTxtFile = "textfileInFrench.txt"
else
strTxtFile = "textfileInEnglish.txt"
end if
Set objFS = CreateObject("Scripting.FileSystemObject"
If not objFS.FileExists(Server.MapPath(strTxtFile)) then
response.write "File Not Found"
Else
Set objFile = objFS.OpenTextFile(Server.MapPath(strTxtFile), 1, false)
Do Until (objFile.AtEndOfStream)
strLine = objFile.readline
GetValue(strLine)
name = GetValue(strLine)
nameArray
y = y + 1
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
strLine = objFile.readline
Loop
objFile.close
Dim bob, i, z
Dim totalElements
i = 0
z = 0
totalElements = 7
for i = 0 to (totalElements - 1)
for z = 1 to totalElements
If nameArray(i) > nameArray(z) then
bob = nameArray(i)
nameArray(i) = nameArray(z)
nameArray(z) = bob
z = z + 1
end if
next
i = i + 1
next
for i = 0 to totalElements
response.write "<ul><li><a href =""#" & nameArray(i) & """>" & nameArray(i) & "</a></ul>"
next
End if