Problem about ASP class

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

USElf

Thread Starter
Joined
Jan 28, 2005
Messages
1
hi experts!

I wanna ask what is the problem of following code?
I was going to write a class which load text into array.
but then I can't modify the 2 level array.

Expected output is:
==================================
CHI
23
True
ABC

asp class processing time: 863.2813 sec.
==================================

But Final outcome is:
==================================
CHI
23
True
CHI

asp class processing time: 863.2813 sec.
==================================

Thanks in advance!




==================================
dim Scrolling_Text
set Scrolling_Text = new cGetTxtAsArr
Scrolling_Text.remarkLines = 4
Scrolling_Text.showTime = true
Scrolling_Text.TxtPath = Server.MapPath("FocusOfTheDay.txt")
Scrolling_Text.getFromFile()
' Scrolling_Text.printArr()

Response.write Scrolling_Text.Arr(0)(0) & "<BR>" & VbCrlf
Scrolling_Text.Arr(0)(0) = "ABC"
response.write ubound(Scrolling_Text.Arr(0)) & "<BR>" & VbCrlf
response.write isArray(Scrolling_Text.Arr(0)) & "<BR>" & VbCrlf
Response.write Scrolling_Text.Arr(0)(0) & "<BR>" & VbCrlf

' Response.write "<BR>" & VbCrlf
' Response.write Scrolling_Text.Arr2(0)
' Scrolling_Text.Arr2(0) = "ABC"
' Response.write Scrolling_Text.Arr2(0)
set Scrolling_Text = nothing

Class cGetTxtAsArr
Public TxtPath, remarkLines, showTime, Arr
Private TristateTrue, TristateFalse, ForReading, ForWriting, ForAppending
Private processing_time

Private sub Class_Initialize()
TristateTrue =-1
TristateFalse =0
ForReading =1
ForWriting =2
ForAppending =3
processing_time =timer()
Redim Arr(999)
end sub

Public function getFromFile
dim fso, file, TextStream
set fso=Server.CreateObject("Scripting.FileSystemObject")

if fso.FileExists(TxtPath) then
Set file = fso.GetFile(TxtPath)
Set TextStream = File.OpenAsTextStream(ForReading, TristateTrue)

dim i
for i=1 to remarkLines
TextStream.ReadLine
next

i=0
dim line, tmp_arr
Do While Not TextStream.AtEndofStream
line = TextStream.ReadLine
tmp_arr = Split(line, chr(9))
if lcase(tmp_arr(0)) <> "end" and lcase(tmp_arr(0)) <> "" then
Arr(i) = Split(line, chr(9))
i=i+1
end if
loop
redim preserve Arr(i-1)
else
response.write TxtPath & " does not exist on this server."
response.end
end if
end function

Public function printArr
response.write "<font size=""2"">" & VbCrlf & VbCrlf
dim i, j
for i=0 to ubound(Arr)
for j=0 to ubound(Arr(i))
response.write Arr(i)(j) & chr(9)
next
response.write VbCrlf
next
response.write "</font>" & VbCrlf & VbCrlf
end function

Private sub Class_Terminate()
set TristateTrue =nothing
set TristateFalse =nothing
set ForReading =nothing
set ForWriting =nothing
set ForAppending =nothing
if showTime = true then
response.write "<p><font size=""2"">asp class processing time: " & (timer()-processing_time)*1000 & " sec.</font></p>"
end if
set showTime =nothing
set processing_time =nothing
end sub

end Class
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top