It could be that I'm no good with types,but I cant seem to find the problem.

VB Code:
  1. Public Sub DrawArrows()
  2. 'Start drawing arrows
  3. Dim ArrowXY(0) As String
  4. For I = LBound(DisplayTree()) To UBound(DisplayTree())
  5.     If DisplayTree(I).Pre <> "" Then
  6.         ReDim Preserve ArrowXY(ubound(GetReq(I))) As String 'Right here is where I get the error
  7.         ArrowXY() = GetReq(I)
  8.         For II = LBound(ArrowXY()) To UBound(ArrowXY())
  9.             Call ArrowTip(Form1.Img1(ArrowXY(II)).Left, Form1.Img1(ArrowXY(II)).Height, Form1.Img1(I).Left, Form1.Img1(I).Height)
  10.         Next II
  11.     End If
  12. Next I
  13. End Sub
  14.  
  15.  
  16.  
  17. Public Function GetReq(ObjID As String) As String()
  18. 'returns all of an objects requirments
  19. Dim DisDef() As String
  20. Dim DisPre() As String
  21. Dim MyReturn(0) As String
  22.  
  23.  
  24. DisPre() = Split(DisplayTree(ObjID).Pre, " ")
  25. For I = LBound(DisplayTree()) To UBound(DisplayTree())
  26.     ReDim DisDef(Split(DisplayTree(ObjID).Def, " ")) As String
  27.     DisDef() = Split(DisplayTree(ObjID).Def, " ")
  28.    
  29.     For II = LBound(DisDef()) To UBound(DisDef())
  30.         For III = LBound(DisPre()) To UBound(DisPre())
  31.             If DisDef(II) = DisPre(III) Then 'found match, return index
  32.                 MyReturn(UBound(MyReturn())) = I
  33.                 ReDim Preserve MyReturn(UBound(MyReturn()) + 1) As String
  34.                 Exit For
  35.             End If
  36.         Next III
  37.     Next II
  38. Next I
  39. ReDim Preserve MyReturn(UBound(MyReturn()) - 1) As String
  40.  
  41.  
  42. MsgBox (Join(MyReturn(), " "))
  43. 'ReDim Preserve GetReq(UBound(MyReturn())) As String
  44. GetReq() = MyReturn()
  45.  
  46. End Function
  47. Public Sub ArrowTip(x1, y1, x2, y2, Index)
  48. If Index <> 0 Then
  49. Load Form1.Lin1(Index)
  50. Load Form1.Lin1a(Index)
  51. Load Form1.Lin1b(Index)
  52. End If
  53.  
  54.     p1 = 0: q2 = 1: p2 = Form1.Width: q1 = Form1.Height
  55.     arrow_length = 30   '0.01 * 1 * Form1.Width
  56.     beta = 30 * PI / 180
  57.     Form1.Lin1(Index).x1 = x1
  58.     Form1.Lin1(Index).y1 = y1
  59.     Form1.Lin1(Index).x2 = x2
  60.     Form1.Lin1(Index).y2 = y2
  61.     Dim salfa As Single, calfa As Single, vector As Single
  62.     Dim cth1 As Single, sth1 As Single
  63.     Dim cth2 As Single, sth2 As Single
  64.     Dim v1 As Single, w1 As Single, v2 As Single, w2 As Single
  65.     Dim xab1 As Single, yab1 As Single, xab2 As Single, yab2 As Single
  66.     Dim vab1 As Single, wab1 As Single, vab2 As Single, wab2 As Single
  67.     'Arrow's main line in "absolute" coordinates
  68.     xab1 = Form1.Width * (x1 - p1) / (p2 - p1)
  69.     yab1 = Form1.Height * (y1 - q1) / (q2 - q1)
  70.     xab2 = Form1.Width * (x2 - p1) / (p2 - p1)
  71.     yab2 = Form1.Height * (y2 - q1) / (q2 - q1)
  72.     'Length of the arrow's main body
  73.     vector = Sqr((xab2 - xab1) * (xab2 - xab1) + (yab2 - yab1) * (yab2 - yab1))
  74.     'Cos(alpha) and Sin(alpha):
  75.     calfa = (xab2 - xab1) / vector
  76.     salfa = (yab2 - yab1) / vector
  77.     'Sin & Cos of the angles between the 2 arrow tips and the x axis
  78.     'th1 = alpha - beta
  79.     'th2 = alpha + beta
  80.     cth1 = calfa * Cos(beta) + salfa * Sin(beta)
  81.     sth1 = salfa * Cos(beta) - calfa * Sin(beta)
  82.     cth2 = calfa * Cos(beta) - salfa * Sin(beta)
  83.     sth2 = salfa * Cos(beta) + calfa * Sin(beta)
  84.     'Arrow tips positions in "absolute" coordinates
  85.     vab1 = xab2 - arrow_length * cth1
  86.     wab1 = yab2 - arrow_length * sth1
  87.     vab2 = xab2 - arrow_length * cth2
  88.     wab2 = yab2 - arrow_length * sth2
  89.     'Back to user coordinates
  90.     v1 = p1 + vab1 * (p2 - p1) / Form1.Width
  91.     w1 = q1 + wab1 * (q2 - q1) / Form1.Height
  92.     v2 = p1 + vab2 * (p2 - p1) / Form1.Width
  93.     w2 = q1 + wab2 * (q2 - q1) / Form1.Height
  94.     Form1.Lin1a(Index).x1 = x2
  95.     Form1.Lin1a(Index).y1 = y2
  96.     Form1.Lin1a(Index).x2 = v1
  97.     Form1.Lin1a(Index).y2 = w1
  98.     Form1.Lin1b(Index).x1 = x2
  99.     Form1.Lin1b(Index).y1 = y2
  100.     Form1.Lin1b(Index).x2 = v2
  101.     Form1.Lin1b(Index).y2 = w2
  102. End Sub