Hello everybody. 
I am writing a piece of VBScript and I
continuously receive a runtime error that says "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index (line :0)"
I'm trying to evaluate list items against each other in the script. Here's the code. 
Private
Sub RunScript(ByVal listA As List(Of Double), ByVal listB As List(Of
Double), ByVal minDist As System.Object, ByVal bracketDistMin As
System.Object, ByVal bracketDistMax As System.Object, ByRef distFix As
Object) 
    Dim masterList As New List(Of Double)
    Dim i As Integer
    For i = 0 To (listA.Count - 1)
      ' If Value is less than desired input, value is rounded up to minDist
      If (listA.Item(i) - listB.Item(i)) <= minDist Then
        masterList.Add(minDist)
        ' If list value is between a threshold above bracketDistMin and below bracketDistMax
        ' the value is rounded up or rounded down based on the mean between the two variables
      Else If (listA.Item(i) - listB.Item(i)) < bracketDistMax > bracketDistMin Then
        If (listA.item(i) - listB.Item(i)) < ((listA.Item(i) + listB.Item(i)) / 2) Then
          masterlist.Add(bracketDistMin)
        Else
          masterlist.Add(bracketDistMax)
        End If
        ' In all other cases, keep difference the same
      Else
        masterlist.Add(listA.Item(i) - listB.Item(i))
      End If
    Next
    distFix = masterList
    
  End Sub 
If
there was a way to preform all these operations without VB, I would
love to know. I studied Java for about a year around 6 years ago, and I
don't have any experience in VB other than what I have been working on
today, so I would like some help!                
             
         
                    Tags: