Need Help With Run Time Errors? 
Author Message
 Need Help With Run Time Errors?

I am getting these run time errors when I test my web page

First error is: "expected end of statement" "at line:" see below

I can not see any error maybe someone else can see it.

Second error is even more stupid: "type mismatch" when I call
the procedure like this:

SortIncrease

or

Call SortIncrease

</script><script language="VBScript"><!--
Sub SortIncrease() ' Global procedure Sort a ListBox
    Dim Top100
    Dim i
    Dim j
    Dim min
    Dim TabPos
    Dim TempMsg
    Dim Score1
    Dim Score2
    Set Top100 = Document.LTop100 ' ListBox
    If Top100.ListCount > 1 Then
        For i = 0 To Top100.ListCount - 1
            min = i
            For j = i + 1 To Top100.ListCount - 1
                TempMsg = Top100.List(j)
                TabPos = InStr(TempMsg, Chr(9))
                Score1 = CInt(Left(TempMsg, TabPos - 1))
                TempMsg = Top100.List(min)
                TabPos = InStr(TempMsg, Chr(9))
                Score2 = CInt(Left(TempMsg, TabPos - 1))
                If Score1 < Score2 Then
                    min = j
                End If     ' This is where the error has occured
            Next j
            TempMsg = Top100.List(min)
            Top100.List(min) = Top100.List(i)
            Top100.List(i) = TempMsg
        Next i
    End If
end sub
--></script>



Thu, 04 Jul 2002 03:00:00 GMT  
 Need Help With Run Time Errors?
Ok I figured it out I guess scripting is a little different from regular vb.
I am new to both vb and vb scripting so bear with me.  When I fix the first
error it took care of the second error but, the procedure is not working as
expected so I need to debug it.

Here's the fix:

<script language="VBScript"><!--
Sub SortIncrease()
    Dim Top100
    Dim i
    Dim j
    Dim min
    Dim TabPos
    Dim TempMsg
    Dim Score1
    Dim Score2
    Set Top100 = Document.LTop100
    If Top100.ListCount > 1 Then
        For i = 0 To Top100.ListCount - 1
            min = i
            For j = i + 1 To Top100.ListCount - 1
                TempMsg = Top100.List(j)
                TabPos = InStr(TempMsg, Chr(9))
                Score1 = CInt(Left(TempMsg, TabPos - 1))
                TempMsg = Top100.List(min)
                TabPos = InStr(TempMsg, Chr(9))
                Score2 = CInt(Left(TempMsg, TabPos - 1))
                If Score1 < Score2 Then
                    min = j
                End If
            Next
            TempMsg = Top100.List(min)
            Top100.List(min) = Top100.List(i)
            Top100.List(i) = TempMsg
        Next
    End If
end sub
--></script>



Thu, 04 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need Help with Run-Time Error 377

2. Need help with run-time error.

3. Need help with run-time error.

4. Need Help with Run-Time Error 377

5. Need Help with run time error (desperate)

6. Help needed : Visual basic 6 + myQDBC + run time errors 80040e38

7. Need help with a run-time error.

8. run-time error 430 (HELP!! IN DIRE NEED)

9. Need Help Run time error on software!

10. Need help -Run time function error

11. Need help about Error message Run-time 429

12. Microsoft Visual C++ Run time library Run time error R6025

 

 
Powered by phpBB® Forum Software