Hello,

I have set up a little test as I need an Array to be updated with values from another Array.

When I monitor AddToArray all seems to go well, but after I run TestArray, I expect MainArray to have 3 new elements and it doesn't.
What am I missing?

Code:
    Dim MainArray() As Object = {"Hello World", 12D, 16UI, "A"c, "blob"}
    Dim AdditionalArray() As Object = {"carriage", 200, "Friend"}

    Sub TestArray()
        Dim i As Integer
        AddToArray(MainArray, AdditionalArray)      ' UBound of MainArray was 7 in TestArray

        MsgBox("Ubound MA = " & UBound(MainArray))  ' here UBound of MainArray is 4 again
        For i = LBound(MainArray) To UBound(MainArray)
            MsgBox(i & ": " & MainArray(i))
        Next
    End Sub

    Sub AddToArray(MainArray As Object, AdditionalArray As Object)
        Dim i As Long
        MsgBox("Initial UBound MA = " & UBound(MainArray))
        For i = LBound(AdditionalArray) To UBound(AdditionalArray)
            ReDim Preserve MainArray(UBound(MainArray) + 1)
            MsgBox("New UBound MA = " & UBound(MainArray))
            MainArray(UBound(MainArray)) = AdditionalArray(i)
        Next
        MsgBox("Final UBound MA = " & UBound(MainArray))
    End Sub